Re: [PATCH] bhyve: fix memory leaks in bhyvexml2argvtest

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

 



On 11/13/2016 05:03 AM, Roman Bogorodskiy wrote:
  * virNetDevTapCreateInBridgePort() mock: free '*ifname' before
    strdupping a hardoded value to it
  * testCompareXMLToArgvFiles(): unref 'conn' object in cleanup
  * testCompareXMLToArgvHelper(): free 'ldargs' and 'dmargs' in
    cleanup
---
  tests/bhyvexml2argvmock.c | 2 ++
  tests/bhyvexml2argvtest.c | 3 +++
  2 files changed, 5 insertions(+)

diff --git a/tests/bhyvexml2argvmock.c b/tests/bhyvexml2argvmock.c
index 41058ca..a851632 100644
--- a/tests/bhyvexml2argvmock.c
+++ b/tests/bhyvexml2argvmock.c
@@ -1,5 +1,6 @@
  #include <config.h>
+#include "viralloc.h"
  #include "virstring.h"
  #include "virnetdev.h"
  #include "virnetdevtap.h"
@@ -29,6 +30,7 @@ int virNetDevTapCreateInBridgePort(const char *brname ATTRIBUTE_UNUSED,
                                     virNetDevVlanPtr virtVlan ATTRIBUTE_UNUSED,
                                     unsigned int fakeflags ATTRIBUTE_UNUSED)
  {
+    VIR_FREE(*ifname);
      if (VIR_STRDUP(*ifname, "vnet0") < 0)
          return -1;
      return 0;
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index b85439b..22a902c 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -86,6 +86,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
      virCommandFree(cmd);
      virCommandFree(ldcmd);
      virDomainDefFree(vmdef);
+    virObjectUnref(conn);
      return ret;
  }
@@ -117,6 +118,8 @@ testCompareXMLToArgvHelper(const void *data)
   cleanup:
      VIR_FREE(xml);
      VIR_FREE(args);
+    VIR_FREE(ldargs);
+    VIR_FREE(dmargs);
      return ret;
  }


ACK.

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