When the LDM code was converted to the CLEANUP_* macros, a free() invocation for a CLEANUP_FREE variable was left in the ldmtool_diskgroup_volumes implementation, causing double-free on success. Updates commit 950951c67de61da27dceca8ffb2079031c13e43b. --- daemon/ldm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/daemon/ldm.c b/daemon/ldm.c index 1bab28989..2f4d2aef3 100644 --- a/daemon/ldm.c +++ b/daemon/ldm.c @@ -286,7 +286,6 @@ do_ldmtool_diskgroup_volumes (const char *diskgroup) reply_with_error ("%s", err); return NULL; } - free (err); return parse_json_get_object_string_list (out, "volumes", __func__, "ldmtool show diskgroup"); -- 2.13.6
Richard W.M. Jones
2017-Nov-03 21:25 UTC
Re: [Libguestfs] [PATCH] daemon: ldm: avoid manual free()
On Fri, Nov 03, 2017 at 05:31:19PM +0100, Pino Toscano wrote:> When the LDM code was converted to the CLEANUP_* macros, a free() > invocation for a CLEANUP_FREE variable was left in the > ldmtool_diskgroup_volumes implementation, causing double-free on > success. > > Updates commit 950951c67de61da27dceca8ffb2079031c13e43b. > --- > daemon/ldm.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/daemon/ldm.c b/daemon/ldm.c > index 1bab28989..2f4d2aef3 100644 > --- a/daemon/ldm.c > +++ b/daemon/ldm.c > @@ -286,7 +286,6 @@ do_ldmtool_diskgroup_volumes (const char *diskgroup) > reply_with_error ("%s", err); > return NULL; > } > - free (err); > > return parse_json_get_object_string_list (out, "volumes", > __func__, "ldmtool show diskgroup"); > -- > 2.13.6Ouch. I guess we don't test this API ..? ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Pino Toscano
2017-Nov-06 11:48 UTC
Re: [Libguestfs] [PATCH] daemon: ldm: avoid manual free()
On Friday, 3 November 2017 22:25:03 CET Richard W.M. Jones wrote:> On Fri, Nov 03, 2017 at 05:31:19PM +0100, Pino Toscano wrote: > > When the LDM code was converted to the CLEANUP_* macros, a free() > > invocation for a CLEANUP_FREE variable was left in the > > ldmtool_diskgroup_volumes implementation, causing double-free on > > success. > > > > Updates commit 950951c67de61da27dceca8ffb2079031c13e43b. > > --- > > daemon/ldm.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/daemon/ldm.c b/daemon/ldm.c > > index 1bab28989..2f4d2aef3 100644 > > --- a/daemon/ldm.c > > +++ b/daemon/ldm.c > > @@ -286,7 +286,6 @@ do_ldmtool_diskgroup_volumes (const char *diskgroup) > > reply_with_error ("%s", err); > > return NULL; > > } > > - free (err); > > > > return parse_json_get_object_string_list (out, "volumes", > > __func__, "ldmtool show diskgroup"); > > Ouch. I guess we don't test this API ..?I'm afraid there are no tests for any of the ldmtool APIs. -- Pino Toscano
Maybe Matching Threads
- [PATCH] Add support for Windows dynamic disks (libldm / ldmtool).
- Re: [PATCH] daemon: ldm: avoid manual free()
- [PATCH libldm v4 0/3] Make libldm to parse and return volume GUID.
- [PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
- [PATCH 0/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.