1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

leaseshelper: fix crash when no mac is specified

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
This commit is contained in:
Ján Tomko 2016-01-14 14:31:17 +01:00
parent 020135dc85
commit df9fe124d6

View 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;