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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]