[libvirt] [PATCH 04/10] Fix crash on OOM in qemuDomainCCWAddressSetCreate()

Peter Krempa pkrempa at redhat.com
Mon Sep 23 16:33:26 UTC 2013


On 09/23/13 15:23, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> If OOM occurs in qemuDomainCCWAddressSetCreate, it jumps to
> a cleanup block and frees the partially initialized object.
> It then mistakenly returns the address of the just free'd
> pointer instead of NULL.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/qemu/qemu_command.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index e6239c9..b20149b 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1275,7 +1275,7 @@ qemuDomainCCWAddressSetCreate(void)
>  
>  cleanup:

The label should be then called "error"

>      qemuDomainCCWAddressSetFree(addrs);
> -    return addrs;
> +    return NULL;
>  }
>  
>  /*
> 

ACK nevertheless.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130923/45859dbf/attachment-0001.sig>


More information about the libvir-list mailing list