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

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



On Tue, Jun 12, 2012 at 07:07:36AM -0700, Radu Caragea wrote:
> 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);

ACK, pushed to GIT.

NB, your mailer did  something wierd to the patch, so it wouldn't apply
on its own. It is best to use 'git send-email' for submitting patches
to avoid accidental whitespace damage

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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