Re: [PATCH] bridge: avoid double free

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

 



On 12/20/2010 06:31 AM, PaweÅ KrzeÅniak wrote:
---
  src/network/bridge_driver.c |    1 -
  1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c3f32d7..b0834ae 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -557,7 +557,6 @@ dhcpStartDhcpDaemon(virNetworkObjPtr network)

      cmd = virCommandNew(DNSMASQ);
      if (networkBuildDnsmasqArgv(network, pidfile, cmd)<  0) {
-        VIR_FREE(pidfile);
          goto cleanup;
      }

Technically not a double free, since VIR_FREE will set the pointer to NULL, turning the second call (at cleanup) into a NOP, but still a worthwhile cleanup.

This crept in when I recently converted the function from virRun to virCommand - previously there had been a "return -1" after this VIR_FREE(), and I changed it to "goto cleanup" so there was a single exit point from the function.

ACK. I added your name to the AUTHORS file and pushed the result.

Thanks for picking this out! Since it seems you've been looking through bridge_driver.c in a fair amount of detail, maybe you'd like to take a look at the patches I just posted this morning to support IPv6 in the bridge driver:

https://www.redhat.com/archives/libvir-list/2010-December/msg00765.html

--
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]