Re: [PATCHv4] network: Avoid memory leaks on networkBuildDnsmasqArgv

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

 



Thanks for your change and pushed.

Regards,
Alex

----- Original Message -----
From: "Eric Blake" <eblake@xxxxxxxxxx>
Cc: ajia@xxxxxxxxxx, libvir-list@xxxxxxxxxx
Sent: Thursday, February 2, 2012 7:44:21 AM
Subject: Re:  [PATCHv4] network: Avoid memory leaks on networkBuildDnsmasqArgv

On 02/01/2012 04:17 PM, Eric Blake wrote:
>> @@ -516,7 +520,6 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
>>          int i;
>>  
>>          for (i = 0; i < dns->ntxtrecords; i++) {
>> -            char *record = NULL;
>>              if (virAsprintf(&record, "%s,%s",
>>                              dns->txtrecords[i].name,
>>                              dns->txtrecords[i].value) < 0) {
> 
> Hmm, we can simplify this loop even further, by using the right function
> in the first place.
> 
> ACK to what you had, and I'm squashing this in then pushing:

Serves me right for testing, then modifying, then pushing without retesting.

> -            virCommandAddArgPair(cmd, "--txt-record", record);
> -            VIR_FREE(record);
> +            virCommandAddArg(cmd, "--txt-record");
> +            virCommandAddArgFormat(cmd, "%s,%s",
> +                                   dns->txtrecords[i].name,
> +                                   dns->txtrecords[i].value);

ArgPair adds an equal sign.  I'm pushing this followup under the
build-breaker rule (since 'make check' indeed catches the otherwise
harmless change in the generated command line).

>From 0aaf88e800673b0fc204458588af6a96631a81c0 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@xxxxxxxxxx>
Date: Wed, 1 Feb 2012 16:42:33 -0700
Subject: [PATCH] network: fix testsuite regression

I slightly botched commit be9fb5a - I converted '--arg=value' to
'--arg value', which has no semantic change, but did trip up the
testsuite.

* src/network/bridge_driver.c (networkBuildDnsmasqArgv): Restore
expected output.
---
 src/network/bridge_driver.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 220f99e..57ebb9f 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -520,8 +520,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
         int i;

         for (i = 0; i < dns->ntxtrecords; i++) {
-            virCommandAddArg(cmd, "--txt-record");
-            virCommandAddArgFormat(cmd, "%s,%s",
+            virCommandAddArgFormat(cmd, "--txt-record=%s,%s",
                                    dns->txtrecords[i].name,
                                    dns->txtrecords[i].value);
         }
-- 
1.7.7.6



-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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