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:
parent
f9b650a848
commit
6bb8edafd9
@ -4478,9 +4478,9 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
|||||||
virCommandAddArg(cmd, str);
|
virCommandAddArg(cmd, str);
|
||||||
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 ||
|
||||||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
||||||
char *codecstr = NULL;
|
|
||||||
|
|
||||||
for (j = 0; j < sound->ncodecs; j++) {
|
for (j = 0; j < sound->ncodecs; j++) {
|
||||||
|
VIR_AUTOFREE(char *) codecstr = NULL;
|
||||||
virCommandAddArg(cmd, "-device");
|
virCommandAddArg(cmd, "-device");
|
||||||
if (!(codecstr =
|
if (!(codecstr =
|
||||||
qemuBuildSoundCodecStr(sound, sound->codecs[j],
|
qemuBuildSoundCodecStr(sound, sound->codecs[j],
|
||||||
@ -4489,9 +4489,9 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
|||||||
|
|
||||||
}
|
}
|
||||||
virCommandAddArg(cmd, codecstr);
|
virCommandAddArg(cmd, codecstr);
|
||||||
VIR_FREE(codecstr);
|
|
||||||
}
|
}
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
|
VIR_AUTOFREE(char *) codecstr = NULL;
|
||||||
virDomainSoundCodecDef codec = {
|
virDomainSoundCodecDef codec = {
|
||||||
VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
|
VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
|
||||||
0
|
0
|
||||||
@ -4504,7 +4504,6 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
|||||||
|
|
||||||
}
|
}
|
||||||
virCommandAddArg(cmd, codecstr);
|
virCommandAddArg(cmd, codecstr);
|
||||||
VIR_FREE(codecstr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user