Re: [PATCH 1/2] free cmd in virNetDevVethDelete

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

 



On 10/04/2013 07:03 PM, Daniel P. Berrange wrote:
> On Fri, Oct 04, 2013 at 06:53:52PM +0800, Gao feng wrote:
>> Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
>> ---
>>  src/util/virnetdevveth.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
>> index 403961b..1085217 100644
>> --- a/src/util/virnetdevveth.c
>> +++ b/src/util/virnetdevveth.c
>> @@ -196,6 +196,7 @@ int virNetDevVethDelete(const char *veth)
>>  {
>>      virCommandPtr cmd = virCommandNewArgList("ip", "link", "del", veth, NULL);
>>      int status;
>> +    int ret = -1;
>>  
>>      if (virCommandRun(cmd, &status) < 0)
>>          return -1;
> 
> This needs to jump to cleanup too.
> 

oops, thanks!

>> @@ -203,11 +204,16 @@ int virNetDevVethDelete(const char *veth)
>>      if (status != 0) {
>>          if (!virNetDevExists(veth)) {
>>              VIR_DEBUG("Device %s already deleted (by kernel namespace cleanup)", veth);
>> -            return 0;
>> +            ret = 0;
>> +            goto cleanup;
>>          }
>>          virReportError(VIR_ERR_INTERNAL_ERROR,
>>                         _("Failed to delete veth device %s"), veth);
>> -        return -1;
>> +        goto cleanup;
>>      }
>> -    return 0;
>> +
>> +    ret = 0;
>> +cleanup:
>> +    virCommandFree(cmd);
>> +    return ret;
>>  }
> 
> ACK, I'll push with the fix mentioned above
> 
> Daniel
> 

--
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]