Re: [PATCH v2 02/12] Fix build errors on FreeBSD

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

 



On 1/2/20 12:46 PM, Ryan Moeller wrote:
From: Ryan Moeller <ryan@xxxxxxxxxxxx>

Don't free the file string until after it has been used to print the
error message.

Simplify PCI bus parsing to eliminate an unannotated switch fallthrough.


I don't think this^^^ comment belongs with this patch...



Signed-off-by: Ryan Moeller <ryan@xxxxxxxxxxxxx>
---
  src/conf/virnetworkobj.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 5daf4a8cb1..5c45f49be0 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1895,13 +1895,14 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net,
          file = g_strdup_printf("%s/%s.xml", dir, de->d_name);
portdef = virNetworkPortDefParseFile(file);
-        VIR_FREE(file);
-        file = NULL;
-
          if (!portdef) {
              VIR_WARN("Cannot parse port %s", file);
+            VIR_FREE(file);
+            file = NULL;


"file = NULL;" is superfluous, since it is already set to NULL by virFree() (which is called by VIR_FREE()).


              continue;
          }
+        VIR_FREE(file);
+        file = NULL;


Same here.


virUUIDFormat(portdef->uuid, uuidstr);
          if (virHashAddEntry(net->ports, uuidstr, portdef) < 0)



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

  Powered by Linux