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

Doug Goldstein cardoe at gentoo.org
Tue Sep 24 21:19:11 UTC 2013


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

ACK

-- 
Doug Goldstein




More information about the libvir-list mailing list