提交 a6b81d55 编写于 作者: R Roman Bogorodskiy

bhyve: fix memory leaks in bhyvexml2argvtest

 * virNetDevTapCreateInBridgePort() mock: free '*ifname' before
   strdupping a hardoded value to it
 * testCompareXMLToArgvFiles(): unref 'conn' object in cleanup
 * testCompareXMLToArgvHelper(): free 'ldargs' and 'dmargs' in
   cleanup
上级 9b39a9dc
#include <config.h> #include <config.h>
#include "viralloc.h"
#include "virstring.h" #include "virstring.h"
#include "virnetdev.h" #include "virnetdev.h"
#include "virnetdevtap.h" #include "virnetdevtap.h"
...@@ -29,6 +30,7 @@ int virNetDevTapCreateInBridgePort(const char *brname ATTRIBUTE_UNUSED, ...@@ -29,6 +30,7 @@ int virNetDevTapCreateInBridgePort(const char *brname ATTRIBUTE_UNUSED,
virNetDevVlanPtr virtVlan ATTRIBUTE_UNUSED, virNetDevVlanPtr virtVlan ATTRIBUTE_UNUSED,
unsigned int fakeflags ATTRIBUTE_UNUSED) unsigned int fakeflags ATTRIBUTE_UNUSED)
{ {
VIR_FREE(*ifname);
if (VIR_STRDUP(*ifname, "vnet0") < 0) if (VIR_STRDUP(*ifname, "vnet0") < 0)
return -1; return -1;
return 0; return 0;
......
...@@ -86,6 +86,7 @@ static int testCompareXMLToArgvFiles(const char *xml, ...@@ -86,6 +86,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
virCommandFree(cmd); virCommandFree(cmd);
virCommandFree(ldcmd); virCommandFree(ldcmd);
virDomainDefFree(vmdef); virDomainDefFree(vmdef);
virObjectUnref(conn);
return ret; return ret;
} }
...@@ -117,6 +118,8 @@ testCompareXMLToArgvHelper(const void *data) ...@@ -117,6 +118,8 @@ testCompareXMLToArgvHelper(const void *data)
cleanup: cleanup:
VIR_FREE(xml); VIR_FREE(xml);
VIR_FREE(args); VIR_FREE(args);
VIR_FREE(ldargs);
VIR_FREE(dmargs);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册