[libvirt] [PATCHv2 1/3] virsh: modify vshStringToArray to duplicate the elements too

Eric Blake eblake at redhat.com
Tue Aug 20 15:42:46 UTC 2013


On 08/20/2013 08:15 AM, Peter Krempa wrote:
> At a slightly larger memory expense allow stealing of items from the
> string array returned from vshStringToArray and turn the result into a
> string list compatible with virStringSplit. This will allow to use the
> common dealloc function.
> 
> This patch also fixes a few forgotten checks of return from
> vshStringToArray and one memory leak.
> ---
> 

> @@ -409,7 +406,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
>              vshError(ctl, "%s", _("Options --tree and --cap are incompatible"));
>              return false;
>          }
> -        ncaps = vshStringToArray(cap_str, &caps);
> +        if ((ncaps = vshStringToArray(cap_str, &caps)) < 0)
> +              return false;

Indentation looks off.

> +++ b/tools/virsh.h
> @@ -37,6 +37,7 @@
>  # include "virerror.h"
>  # include "virthread.h"
>  # include "virnetdevbandwidth.h"
> +# include "virstring.h"

Is this change necessary?

-- 
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/20130820/fb3256e0/attachment-0001.sig>


More information about the libvir-list mailing list