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
This commit is contained in:
Daniel P. Berrange 2010-12-01 16:42:17 +00:00
parent 6fda7ea537
commit c846bc9eb8

View File

@ -980,8 +980,8 @@ void virLogSetFromEnv(void) {
virLogParseDefaultPriority(debugEnv); virLogParseDefaultPriority(debugEnv);
debugEnv = getenv("LIBVIRT_LOG_FILTERS"); debugEnv = getenv("LIBVIRT_LOG_FILTERS");
if (debugEnv && *debugEnv) if (debugEnv && *debugEnv)
virLogParseFilters(strdup(debugEnv)); virLogParseFilters(debugEnv);
debugEnv = getenv("LIBVIRT_LOG_OUTPUTS"); debugEnv = getenv("LIBVIRT_LOG_OUTPUTS");
if (debugEnv && *debugEnv) if (debugEnv && *debugEnv)
virLogParseOutputs(strdup(debugEnv)); virLogParseOutputs(debugEnv);
} }