From: Pavel Hrdina Date: Mon, 16 Jun 2014 12:16:22 +0000 (+0200) Subject: leaseshelper: fix another crash X-Git-Tag: v1.2.6-rc1~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=647bdf02d8a72e0f17c716cca42d145aedf8c3e4;p=thirdparty%2Flibvirt.git leaseshelper: fix another crash We create a 'lease_new' when we are adding new lease entry, then later in the code we add the 'lease_new' into a 'leases_array_new' which leads into the crash because we double free the 'lease_new'. To prevent the double free we set the 'lease_new' to NULL after successful append into the 'leases_array_new'. Signed-off-by: Pavel Hrdina --- diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index 69081c3581..bf1842b87f 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -331,6 +331,7 @@ main(int argc, char **argv) _("failed to create json")); goto cleanup; } + lease_new = NULL; } if (!(leases_str = virJSONValueToString(leases_array_new, true))) {