]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
bridge: leases: Fix potential crash caused by use after free
authorPeter Krempa <pkrempa@redhat.com>
Tue, 24 Jun 2014 11:52:57 +0000 (13:52 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 24 Jun 2014 13:17:22 +0000 (15:17 +0200)
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.

src/network/bridge_driver.c

index 69c66f3b39751303e753fc97612b0e9cdf3dfcdf..1c20b66fd66f7e12021251c0444d9ae91fb7f4f0 100644 (file)
@@ -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 */