From: Daniel P. Berrange Date: Tue, 24 Sep 2013 15:26:18 +0000 (+0100) Subject: Fix leak on OOM in qemuBuildCommandLine dealing with sound card X-Git-Tag: v1.1.3-rc1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86139a408dae1f238f9bec6e1eac2f59dc8c00db;p=thirdparty%2Flibvirt.git Fix leak on OOM in qemuBuildCommandLine dealing with sound card 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 --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 50b4d70aa8..caabf81d6e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9102,7 +9102,7 @@ qemuBuildCommandLine(virConnectPtr conn, goto error; virCommandAddArg(cmd, str); - + VIR_FREE(str); if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 || sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) { char *codecstr = NULL; @@ -9130,8 +9130,6 @@ qemuBuildCommandLine(virConnectPtr conn, VIR_FREE(codecstr); } } - - VIR_FREE(str); } } } else {