Re: [PATCH] utils/module: fix memleak in module_load()
Marc-André Lureau <[email protected]> Tue, 30 Jun 2026 13:43:13 +0400
| Newsgroups | org.nongnu.qemu-trivial,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <CAJ+F1C+cS7c=Mc2GAn-WQ-XmCPU-hQM4JuDFsEkS87q0yTdrNg@mail.gmail.com> |
Hi On Tue, Jun 30, 2026 at 1:35 PM Dmitry Frolov <[email protected]> wrote: > > Memmory for version_dir, allocated by g_strdup, is not freed > memory > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Dmitry Frolov <[email protected]> > --- > util/module.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/util/module.c b/util/module.c > index 09dc43f51e..dbca6bc8be 100644 > --- a/util/module.c > +++ b/util/module.c > @@ -243,6 +243,7 @@ int module_load(const char *prefix, const char *name, Error **errp) > G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~", > '_'); > dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir); > + g_free(version_dir); Or declare the variable with g_autofree? Reviewed-by: Marc-André Lureau <[email protected]> > #endif > assert(n_dirs <= ARRAY_SIZE(dirs)); > > -- > 2.34.1 > >