[libvirt] [PATCH v3 18/34] Adapt to VIR_STRDUP and VIR_STRNDUP in src/remote/*

Eric Blake eblake at redhat.com
Thu May 9 03:13:00 UTC 2013


On 05/03/2013 08:53 AM, Michal Privoznik wrote:
> ---
>  src/remote/remote_driver.c | 114 +++++++++++++++++----------------------------
>  1 file changed, 44 insertions(+), 70 deletions(-)
> 
> @@ -4472,15 +4449,15 @@ remoteDomainBuildEventGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
>      if (VIR_ALLOC(localAddr) < 0)
>          goto no_memory;
>      localAddr->family = msg->local.family;
> -    if (!(localAddr->service = strdup(msg->local.service)) ||
> -        !(localAddr->node = strdup(msg->local.node)))
> +    if (VIR_STRDUP(localAddr->service, msg->local.service) < 0 ||
> +        VIR_STRDUP(localAddr->node, msg->local.node) < 0)
>          goto no_memory;

double-oom, but...

>  
>      if (VIR_ALLOC(remoteAddr) < 0)
>          goto no_memory;

...you'll be making another pass anyway.

ACK.

There's also a lot of strdup() in src/remote/remote_client_bodies.h; you
probably need to touch up src/rpc/gendispatch.pl to generate nicer code
there.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list