Re: [PATCH 02/13] qemuxml2argvtest: Resolve resource leaks found by Valgrind

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

 



On 2013年02月07日 05:35, John Ferlan wrote:
Valgrind deterimined that fakeSecretGetValue() was using the secret
value without checking validity.  Returning NULL causes the caller
to emit a message and results in failure.

Additionally commit 'b090aa7d' changes leaked vncSASLdir and vncTLSx509certdir
---
  tests/qemuxml2argvtest.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 4e90b26..938dc32 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -31,6 +31,9 @@ fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
                     unsigned int internalFlags ATTRIBUTE_UNUSED)
  {
      char *secret = strdup("AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A");
+    if (!secret) {
+        return NULL;
+    }
      *value_size = strlen(secret);
      return (unsigned char *) secret;
  }
@@ -559,7 +562,8 @@ mymain(void)
      driver.config->vncTLSx509verify = 1;
      DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC);
      driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
-    driver.config->vncSASLdir = driver.config->vncTLSx509certdir = NULL;
+    VIR_FREE(driver.config->vncSASLdir);
+    VIR_FREE(driver.config->vncTLSx509certdir);

      DO_TEST("graphics-sdl", NONE);
      DO_TEST("graphics-sdl-fullscreen", NONE);

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]