1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemuBuildSoundCommandLine: reduce scope of codecstr

Copy the declaration into the smallest blocks it's used in
and mark it as VIR_AUTOFREE.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Ján Tomko 2019-08-26 22:23:50 +02:00
parent f9b650a848
commit 6bb8edafd9

View File

@ -4478,9 +4478,9 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
virCommandAddArg(cmd, str);
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
char *codecstr = NULL;
for (j = 0; j < sound->ncodecs; j++) {
VIR_AUTOFREE(char *) codecstr = NULL;
virCommandAddArg(cmd, "-device");
if (!(codecstr =
qemuBuildSoundCodecStr(sound, sound->codecs[j],
@ -4489,9 +4489,9 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
}
virCommandAddArg(cmd, codecstr);
VIR_FREE(codecstr);
}
if (j == 0) {
VIR_AUTOFREE(char *) codecstr = NULL;
virDomainSoundCodecDef codec = {
VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
0
@ -4504,7 +4504,6 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
}
virCommandAddArg(cmd, codecstr);
VIR_FREE(codecstr);
}
}
}