]> xenbits.xensource.com Git - libvirt.git/commitdiff
leaseshelper: fix crash when no mac is specified
authorJán Tomko <jtomko@redhat.com>
Thu, 14 Jan 2016 13:31:17 +0000 (14:31 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 20 Jan 2016 08:32:59 +0000 (09:32 +0100)
If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6
lease) but no DNSMASQ_MAC, we skip creation of the new lease object.

Also skip adding it to the leases array.

https://bugzilla.redhat.com/show_bug.cgi?id=1202350

src/network/leaseshelper.c

index 2d528f7d2914582b81fc24d9181a77cc77755bda..6930310ae1361cad631ae60b135468cfafb4611e 100644 (file)
@@ -439,7 +439,7 @@ main(int argc, char **argv)
 
     case VIR_LEASE_ACTION_OLD:
     case VIR_LEASE_ACTION_ADD:
-        if (virJSONValueArrayAppend(leases_array_new, lease_new) < 0) {
+        if (lease_new && virJSONValueArrayAppend(leases_array_new, lease_new) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("failed to create json"));
             goto cleanup;