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

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



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


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