From: "Daniel P. Berrange" <berrange(a)redhat.com>
The qemuBuildCommandLine code for parsing sound cards will leak
an intermediate variable if an OOM occurs. Move the free'ing of
the variable earlier to avoid the leak.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_command.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e0fd38e..a82c5dd 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9009,7 +9009,7 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
virCommandAddArg(cmd, str);
-
+ VIR_FREE(str);
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) {
char *codecstr = NULL;
@@ -9036,8 +9036,6 @@ qemuBuildCommandLine(virConnectPtr conn,
VIR_FREE(codecstr);
}
}
-
- VIR_FREE(str);
}
}
} else {
--
1.8.3.1