提交 6de78c63 编写于 作者: J John Ferlan

util: Resolve memory leaks in virLogParse{Output|Filter}

In both virLogParseOutput and virLogParseFilter, rather than returning
NULL, goto cleanup since it's possible that for each the first condition
passes, but the || condition doesn't and thus we leak memory.
上级 95e66fce
......@@ -1466,7 +1466,7 @@ virLogParseOutput(const char *src)
if (!(tokens = virStringSplitCount(src, ":", 0, &count)) || count < 2) {
virReportError(VIR_ERR_INVALID_ARG,
_("Malformed format for output '%s'"), src);
return NULL;
goto cleanup;
}
if (virStrToLong_uip(tokens[0], NULL, 10, &prio) < 0 ||
......@@ -1575,7 +1575,7 @@ virLogParseFilter(const char *src)
if (!(tokens = virStringSplitCount(src, ":", 0, &count)) || count != 2) {
virReportError(VIR_ERR_INVALID_ARG,
_("Malformed format for filter '%s'"), src);
return NULL;
goto cleanup;
}
if (virStrToLong_uip(tokens[0], NULL, 10, &prio) < 0 ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册