From: Ján Tomko Date: Thu, 14 Jan 2016 13:31:17 +0000 (+0100) Subject: leaseshelper: fix crash when no mac is specified X-Git-Tag: v1.2.18.3~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5ef3cbb2cdc3dd497b00228512d7936c34a9cc3;p=thirdparty%2Flibvirt.git 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 (cherry picked from commit df9fe124d650bc438c531673492569da87523d20) Signed-off-by: Ján Tomko --- diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index 2d528f7d29..6930310ae1 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -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;