Fix: tests: leak of prefix on error to register lttng namespace
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 25 Sep 2019 20:55:35 +0000 (16:55 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 25 Sep 2019 20:57:48 +0000 (16:57 -0400)
prefix should always be free'd in this function.

1402045 Resource leak
The system resource will not be reclaimed and reused, reducing the
future availability of the resource.

In register_lttng_namespace: Leak of memory or pointers to system
resources (CWE-404)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/tools/mi/extract_xml.c

index ddf8c16773331b9786b2018c4cbf2d7fb5a651e5..ae07689e239f4a44168d91b396f4a649fc68d134 100644 (file)
@@ -155,8 +155,8 @@ static int register_lttng_namespace(xmlXPathContextPtr xpathCtx)
        }
 
        ret = xmlXPathRegisterNs(xpathCtx, prefix, ns);
        }
 
        ret = xmlXPathRegisterNs(xpathCtx, prefix, ns);
-       xmlFree(prefix);
 end:
 end:
+       xmlFree(prefix);
        xmlFree(ns);
        return ret;
 }
        xmlFree(ns);
        return ret;
 }
This page took 0.027675 seconds and 5 git commands to generate.