xenConfigGetString returns a newly-allocated pointer and it has to be
freed by the caller.
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
src/xenconfig/xen_common.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index f787827008..5d88577222 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1060,17 +1060,22 @@ static int
xenParseEmulatedDevices(virConfPtr conf, virDomainDefPtr def)
{
const char *str;
+ int ret = -1;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
if (xenConfigGetString(conf, "soundhw", &str, NULL) < 0)
- return -1;
+ goto cleanup;
if (str &&
xenParseSxprSound(def, str) < 0)
- return -1;
+ goto cleanup;
}
- return 0;
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(str);
+ return ret;
}
--
2.17.1