[PATCH 3/8] virHostValidateBhyve: Heap allocate massive 'struct kld_file_stat'

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/virt-host-validate-bhyve.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bhyve.c
index 9457fac9a5..db1cdd8e2c 100644
--- a/tools/virt-host-validate-bhyve.c
+++ b/tools/virt-host-validate-bhyve.c
@@ -49,24 +49,24 @@ int virHostValidateBhyve(void)
 {
     int ret = 0;
     int fileid = 0;
-    struct kld_file_stat stat;
+    g_autofree struct kld_file_stat *stat = g_new0(struct kld_file_stat, 1);
     bool vmm_loaded = false;
     bool if_tap_loaded = false;
     bool if_bridge_loaded = false;
     bool nmdm_loaded = false;

     for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) {
-        stat.version = sizeof(struct kld_file_stat);
-        if (kldstat(fileid, &stat) < 0)
+        stat->version = sizeof(struct kld_file_stat);
+        if (kldstat(fileid, stat) < 0)
             continue;

-        if (STREQ(stat.name, "vmm.ko"))
+        if (STREQ(stat->name, "vmm.ko"))
             vmm_loaded = true;
-        else if (STREQ(stat.name, "if_tap.ko"))
+        else if (STREQ(stat->name, "if_tap.ko"))
             if_tap_loaded = true;
-        else if (STREQ(stat.name, "if_bridge.ko"))
+        else if (STREQ(stat->name, "if_bridge.ko"))
             if_bridge_loaded = true;
-        else if (STREQ(stat.name, "nmdm.ko"))
+        else if (STREQ(stat->name, "nmdm.ko"))
             nmdm_loaded = true;
     }

-- 
2.41.0




[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