提交 c846bc9e 编写于 作者: D Daniel P. Berrange

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
上级 6fda7ea5
...@@ -980,8 +980,8 @@ void virLogSetFromEnv(void) { ...@@ -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);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册