[sandbox][PATCH]builder-machine: fix incorrect memory allocation

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

 



Features should be allocated with 2 elements, one to be "acpi" and one to be a NULL pointer indicating string array termination. (Caught with valgrind)

diff --git a/libvirt-sandbox/libvirt-sandbox-builder-machine.c b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
index 7087459..3f7c5d7 100644
--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
+++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
@@ -391,7 +387,7 @@ static gboolean gvir_sandbox_builder_machine_construct_features(GVirSandboxBuild
         construct_features(builder, config, configdir, cleaner, domain, error))
         return FALSE;
 
-    features = g_new0(gchar *, 1);
+    features = g_new0(gchar *, 2);
     features[0] = g_strdup("acpi");
     gvir_config_domain_set_features(domain, features);
     g_strfreev(features);


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