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

Fix memory leaks in audit & VirtualBox code

* src/util/virtaudit.c: Free audit string
* src/vbox/vbox_XPCOMCGlue.c: Free library name
上级 6b3ede3f
......@@ -32,6 +32,7 @@
#include "virtaudit.h"
#include "util.h"
#include "files.h"
#include "memory.h"
/* Provide the macros in case the header file is old.
FIXME: should be removed. */
......@@ -110,8 +111,10 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
}
#if HAVE_AUDIT
if (auditfd < 0)
if (auditfd < 0) {
VIR_FREE(str);
return;
}
if (str) {
static const int record_types[] = {
......@@ -128,6 +131,7 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
VIR_WARN("Failed to send audit message %s: %s",
NULLSTR(str), virStrerror(errno, ebuf, sizeof ebuf));
}
VIR_FREE(str);
}
#endif
}
......
......@@ -98,6 +98,7 @@ static int tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing)
VIR_ERROR(_("Libaray '%s' doesn't exist"), name);
}
VIR_FREE(name);
return -1;
}
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册