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

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

 



On 08/20/13 17:42, Eric Blake wrote:
> 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.

Hmm, yes.

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

It's to import virStringFreeList to virsh as it's used to free the
string list from vshStringToArray in most places. Adding it to the
corresponding files calling it might save half of the includes though. I
can change it to separate includes if you wish so.

Peter


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]