From: Peter Krempa Date: Tue, 24 Jun 2014 11:52:57 +0000 (+0200) Subject: bridge: leases: Fix potential crash caused by use after free X-Git-Tag: v1.2.6-rc1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11863f70679892cdffd80b184c87617faed94166;p=thirdparty%2Flibvirt.git bridge: leases: Fix potential crash caused by use after free Don't free individual JSON array members as the array will be freed at the end. This may potentially lead to a crash although it didn't crash on my setup. --- diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 69c66f3b39..1c20b66fd6 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3437,10 +3437,8 @@ networkGetDHCPLeasesHelper(virNetworkObjPtr obj, goto error; } - if (mac && virMacAddrCompare(mac, mac_tmp)) { - virJSONValueFree(lease_tmp); + if (mac && virMacAddrCompare(mac, mac_tmp)) continue; - } if (virJSONValueObjectGetNumberLong(lease_tmp, "expiry-time", &expirytime_tmp) < 0) { /* A lease cannot be present without expiry-time */