[libvirt] [sandbox][PATCH]builder-machine: fix incorrect memory allocation
Radu Caragea
dmns_serp at yahoo.com
Tue Jun 12 14:07:36 UTC 2012
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);
More information about the libvir-list
mailing list