[libvirt PATCH] test: fix leak of authentication info

Daniel P. Berrangé posted 1 patch 4 years ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200305165801.2747491-1-berrange@redhat.com
src/test/test_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
[libvirt PATCH] test: fix leak of authentication info
Posted by Daniel P. Berrangé 4 years ago
The 'auths' struct in the test driver was not free()d. This was easy to
miss because the default XML doesn't include auth info.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/test/test_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 029d560fb9..73fe1ad6ce 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -156,6 +156,7 @@ static void
 testDriverDispose(void *obj)
 {
     testDriverPtr driver = obj;
+    size_t i;
 
     virObjectUnref(driver->caps);
     virObjectUnref(driver->xmlopt);
@@ -165,6 +166,11 @@ testDriverDispose(void *obj)
     virObjectUnref(driver->ifaces);
     virObjectUnref(driver->pools);
     virObjectUnref(driver->eventState);
+    for (i = 0; i < driver->numAuths; i++) {
+        g_free(driver->auths[i].username);
+        g_free(driver->auths[i].password);
+    }
+    g_free(driver->auths);
 }
 
 typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
-- 
2.24.1

Re: [libvirt PATCH] test: fix leak of authentication info
Posted by Daniel Henrique Barboza 4 years ago

On 3/5/20 1:58 PM, Daniel P. Berrangé wrote:
> The 'auths' struct in the test driver was not free()d. This was easy to
> miss because the default XML doesn't include auth info.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>