[PATCH 01/16] Fix build errors on FreeBSD

Ryan Moeller ryan at ixsystems.com
Sat Feb 22 06:38:40 UTC 2020


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

I was seeing `undefined symbol: rpl_ioctl` so followed the example set
by 05a38d4c4ac035ca5dac0f00ce641a8f9b087831

Signed-off-by: Ryan Moeller <ryan at iXsystems.com>
---
 src/bhyve/bhyve_process.c | 1 -
 src/conf/virnetworkobj.c  | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 519604f898..14f718403d 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -27,7 +27,6 @@
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #include <sys/user.h>
-#include <sys/ioctl.h>
 #include <net/if.h>
 #include <net/if_tap.h>
 
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 299cdba52d..1ec1585d1c 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1894,13 +1894,12 @@ 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);
             continue;
         }
+        VIR_FREE(file);
 
         virUUIDFormat(portdef->uuid, uuidstr);
         if (virHashAddEntry(net->ports, uuidstr, portdef) < 0)
-- 
2.24.1





More information about the libvir-list mailing list