[libvirt] [PATCH] Fix NULL dereference in remoteDomainMigratePrepare2

Eric Blake eblake at redhat.com
Wed May 12 15:02:38 UTC 2010


On 05/12/2010 08:53 AM, jdenemar at redhat.com wrote:
> From: Jiri Denemark <jdenemar at redhat.com>
> 
> ---
>  src/remote/remote_driver.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 990bfce..c62e3d6 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -2849,8 +2849,12 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn,
>          goto done;
>  
>      if (ret.cookie.cookie_len > 0) {
> -        *cookie = ret.cookie.cookie_val; /* Caller frees. */
> -        *cookielen = ret.cookie.cookie_len;
> +        if (cookie && cookielen) {
> +            *cookie = ret.cookie.cookie_val; /* Caller frees. */
> +            *cookielen = ret.cookie.cookie_len;
> +        } else {
> +            VIR_FREE(ret.cookie.cookie_val);
> +        }

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list