Re: [PATCH 08/17] Fix leak on OOM in qemuBuildCommandLine dealing with sound card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 24, 2013 at 11:03 AM, Daniel P. Berrange
<berrange@xxxxxxxxxx> wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> ---
>  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
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

ACK

-- 
Doug Goldstein

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]