[virt-tools-list] [vhostmd PATCH 13/18] vhostmd: Fix memory leak in parse_transports

Jim Fehlig jfehlig at suse.com
Wed Jan 15 22:07:46 UTC 2020


>From coverity scan

vhostmd-1.1/vhostmd/vhostmd.c:455: alloc_fn: Storage is returned from allocation function "xmlXPathEval".
vhostmd-1.1/vhostmd/vhostmd.c:455: var_assign: Assigning: "obj" = storage returned from "xmlXPathEval((xmlChar *)"//vhostmd/globals/transport", ctxt)".
vhostmd-1.1/vhostmd/vhostmd.c:474: leaked_storage: Variable "obj" going out of scope leaks the storage it points to.
  472|   #else
  473|   	     vu_log (VHOSTMD_ERR, "No support for xenstore transport in this vhostmd");
  474|-> 	     return -1;
  475|   #endif
  476|   	 }

Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---
 vhostmd/vhostmd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c
index 7374ec9..3d1d53e 100644
--- a/vhostmd/vhostmd.c
+++ b/vhostmd/vhostmd.c
@@ -472,6 +472,7 @@ static int parse_transports(xmlDocPtr xml,
              transports |= XENSTORE;
 #else
 	     vu_log (VHOSTMD_ERR, "No support for xenstore transport in this vhostmd");
+         xmlXPathFreeObject(obj);
 	     return -1;
 #endif
 	 }
-- 
2.16.4





More information about the virt-tools-list mailing list