]> xenbits.xensource.com Git - libvirt.git/commitdiff
leaseshelper: fix another crash
authorPavel Hrdina <phrdina@redhat.com>
Mon, 16 Jun 2014 12:16:22 +0000 (14:16 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 16 Jun 2014 12:41:19 +0000 (14:41 +0200)
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 <phrdina@redhat.com>
src/network/leaseshelper.c

index 69081c3581eea2cc68db45601a57f0d33c8ff1d3..bf1842b87fb6ac61a9efa4c557100f0f157799bb 100644 (file)
@@ -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))) {