[Libvir] PATCH: 8/10: Fix misc mem leaks

Richard W.M. Jones rjones at redhat.com
Thu Nov 29 17:28:07 UTC 2007


Daniel P. Berrange wrote:

All ACKed except:

> @@ -3808,20 +3808,13 @@ server_error (virConnectPtr conn, remote
>      dom = err->dom ? get_nonnull_domain (conn, *err->dom) : NULL;
>      net = err->net ? get_nonnull_network (conn, *err->net) : NULL;
>  
> -    /* These strings are nullable.  OK to ignore the return value
> -     * of strdup since these strings are informational.
> -     */
> -    char *str1 = err->str1 ? strdup (*err->str1) : NULL;
> -    char *str2 = err->str2 ? strdup (*err->str2) : NULL;
> -    char *str3 = err->str3 ? strdup (*err->str3) : NULL;
> -
> -    char *message = err->message ? strdup (*err->message) : NULL;
> -
>      __virRaiseError (conn, dom, net,
>                       err->domain, err->code, err->level,
> -                     str1, str2, str3,
> +                     err->str1 ? *err->str1 : NULL,
> +                     err->str2 ? *err->str2 : NULL,
> +                     err->str3 ? *err->str3 : NULL,
>                       err->int1, err->int2,
> -                     "%s", message);
> +                     "%s", err->message ? *err->message : NULL);
>  }
>  
>  /* get_nonnull_domain and get_nonnull_network turn an on-wire

Don't we need to dup these strings because the following xdr_free (in 
the caller) will free them?

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071129/b02259d6/attachment-0001.bin>


More information about the libvir-list mailing list