[PATCH 2/8] Fix memory leak in logging setup

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

 



The logging setup requires const char * strings, but the
virLogSetFromEnv() strdup's the env variables, thus causing
a memory leak

* src/util/logging.c: Avoid strdup'ing env variables
---
 src/util/logging.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/logging.c b/src/util/logging.c
index d65dec0..83cc358 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -980,8 +980,8 @@ void virLogSetFromEnv(void) {
         virLogParseDefaultPriority(debugEnv);
     debugEnv = getenv("LIBVIRT_LOG_FILTERS");
     if (debugEnv && *debugEnv)
-        virLogParseFilters(strdup(debugEnv));
+        virLogParseFilters(debugEnv);
     debugEnv = getenv("LIBVIRT_LOG_OUTPUTS");
     if (debugEnv && *debugEnv)
-        virLogParseOutputs(strdup(debugEnv));
+        virLogParseOutputs(debugEnv);
 }
-- 
1.7.2.3

--
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]