From: Richard Jones Date: Mon, 11 May 2009 09:51:21 +0000 (+0100) Subject: Perl bindings fix: Not enough memory was allocated for array params. X-Git-Tag: 1.0.23~2 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=09128ca421f13da9fb6446cd7b09b0ae89c3876f;ds=sidebyside Perl bindings fix: Not enough memory was allocated for array params. --- diff --git a/BUGS b/BUGS index 2715ba7..2732f52 100644 --- a/BUGS +++ b/BUGS @@ -54,3 +54,4 @@ quite hard to fix cleanly. [perl] Perl bindings cause a segfault when you call any command which takes a StringList (eg. $g->command). +[should be fixed now] diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs index 27e03d0..5ce5def 100644 --- a/perl/Guestfs.xs +++ b/perl/Guestfs.xs @@ -68,7 +68,7 @@ XS_unpack_charPtrPtr (SV *arg) { croak ("array reference expected"); av = (AV *)SvRV (arg); - ret = malloc (av_len (av) + 1 + 1); + ret = malloc ((av_len (av) + 1 + 1) * sizeof (char *)); if (!ret) croak ("malloc failed"); diff --git a/src/generator.ml b/src/generator.ml index f7057d0..7f24802 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -4862,7 +4862,7 @@ XS_unpack_charPtrPtr (SV *arg) { croak (\"array reference expected\"); av = (AV *)SvRV (arg); - ret = malloc (av_len (av) + 1 + 1); + ret = malloc ((av_len (av) + 1 + 1) * sizeof (char *)); if (!ret) croak (\"malloc failed\");