From c846bc9eb8aa891e4971968fefd2a00e2a25baae Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 1 Dec 2010 16:42:17 +0000 Subject: [PATCH] Fix memory leak in logging setup 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 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/logging.c b/src/util/logging.c index d65dec077c..83cc358c08 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); }