[libvirt] [PATCH] qemu_conf: Don't discard strdup OOM error

Osier Yang jyang at redhat.com
Thu Apr 25 11:43:45 UTC 2013


On 25/04/13 19:37, Michal Privoznik wrote:
> After 78d7c3c5 we are strdup()-ing path to qemu-bridge-helper.
> However, the check for its return value is missing. So it is
> possible we've ignored the OOM error silently.
> ---
>   src/qemu/qemu_conf.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index e9a3407..7c3f317 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -241,7 +241,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
>           }
>       }
>   #endif
> -    cfg->bridgeHelperName = strdup("/usr/libexec/qemu-bridge-helper");
> +    if (!(cfg->bridgeHelperName = strdup("/usr/libexec/qemu-bridge-helper")))
> +        goto no_memory;
>   
>       cfg->clearEmulatorCapabilities = true;
>   
ACK




More information about the libvir-list mailing list