Message ID | 20170221141451.28305-31-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Hi Marc-André, There is no documentation in "hw/qdev-core.h" for qdev_get_dev_path() and his name doesn't suggest any Heap allocation (like many others). Is there a recommended way in Qemu codebase to give to the user/caller a hit to care about releasing memory? "Learn to Read the Source, Luke." On 02/21/2017 11:19 AM, Dr. David Alan Gilbert wrote: > * Marc-André Lureau (marcandre.lureau@redhat.com) wrote: >> This leak was introduced in commit >> 581f08bac22bdd5e081ae07f68071a0fc3c5c2c7. >> >> (it stands out quickly with ASAN once the rest of the leaks are also >> removed from make check with this series) > > Oops yes. > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > >> >> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> >> Cc: Juan Quintela <quintela@redhat.com> >> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> >> --- >> migration/savevm.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/migration/savevm.c b/migration/savevm.c >> index 5ecd264134..87c7a00832 100644 >> --- a/migration/savevm.c >> +++ b/migration/savevm.c >> @@ -688,6 +688,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, >> >> return -1; >> } >> + g_free(id); >> >> se->compat = g_new0(CompatEntry, 1); >> pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), vmsd->name); >> -- >> 2.11.0.295.gd7dffce1c.dirty >> > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK >
Hi On Tue, Feb 21, 2017 at 9:43 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > Hi Marc-André, > > There is no documentation in "hw/qdev-core.h" for qdev_get_dev_path() > and his name doesn't suggest any Heap allocation (like many others). > Is there a recommended way in Qemu codebase to give to the user/caller a > hit to care about releasing memory? "Learn to Read the Source, Luke." > Not much hint, except that the returned value is not const. But I did verify this when I wrote the patch. thanks > On 02/21/2017 11:19 AM, Dr. David Alan Gilbert wrote: > > * Marc-André Lureau (marcandre.lureau@redhat.com) wrote: > >> This leak was introduced in commit > >> 581f08bac22bdd5e081ae07f68071a0fc3c5c2c7. > >> > >> (it stands out quickly with ASAN once the rest of the leaks are also > >> removed from make check with this series) > > > > Oops yes. > > > > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > > > > >> > >> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> > >> Cc: Juan Quintela <quintela@redhat.com> > >> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > >> --- > >> migration/savevm.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff --git a/migration/savevm.c b/migration/savevm.c > >> index 5ecd264134..87c7a00832 100644 > >> --- a/migration/savevm.c > >> +++ b/migration/savevm.c > >> @@ -688,6 +688,7 @@ int vmstate_register_with_alias_id(DeviceState > *dev, int instance_id, > >> > >> return -1; > >> } > >> + g_free(id); > >> > >> se->compat = g_new0(CompatEntry, 1); > >> pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), > vmsd->name); > >> -- > >> 2.11.0.295.gd7dffce1c.dirty > >> > > -- > > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > > > > -- Marc-André Lureau
* Marc-André Lureau (marcandre.lureau@redhat.com) wrote: > This leak was introduced in commit > 581f08bac22bdd5e081ae07f68071a0fc3c5c2c7. > > (it stands out quickly with ASAN once the rest of the leaks are also > removed from make check with this series) > > Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> > Cc: Juan Quintela <quintela@redhat.com> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Queued just this one. > --- > migration/savevm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/migration/savevm.c b/migration/savevm.c > index 5ecd264134..87c7a00832 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -688,6 +688,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, > > return -1; > } > + g_free(id); > > se->compat = g_new0(CompatEntry, 1); > pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), vmsd->name); > -- > 2.11.0.295.gd7dffce1c.dirty > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff --git a/migration/savevm.c b/migration/savevm.c index 5ecd264134..87c7a00832 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -688,6 +688,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, return -1; } + g_free(id); se->compat = g_new0(CompatEntry, 1); pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), vmsd->name);
This leak was introduced in commit 581f08bac22bdd5e081ae07f68071a0fc3c5c2c7. (it stands out quickly with ASAN once the rest of the leaks are also removed from make check with this series) Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Juan Quintela <quintela@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- migration/savevm.c | 1 + 1 file changed, 1 insertion(+)