[PATCH] bridge: leases: Fix potential crash caused by use after free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index d5577e0..f3aff1c 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 */
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]