This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
OP_MULTICONCAT: fix AIX
authorDavid Mitchell <davem@iabyn.com>
Tue, 14 Nov 2017 13:27:59 +0000 (13:27 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 14 Nov 2017 14:11:57 +0000 (14:11 +0000)
The OP_MULTICONCAT work broke AIX builds because it turns out that
PerlMemShared_malloc() isn't safe (in the sense of safemalloc());
i.e. on AIX, PerlMemShared_malloc(0) returns NULL.

op.c

diff --git a/op.c b/op.c
index 18631d0..8fa5aad 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3043,7 +3043,7 @@ S_maybe_multiconcat(pTHX_ OP *o)
                          + ((nargs + 1) * (variant ? 2 : 1))
                         )
                     );
-    const_str = (char *)PerlMemShared_malloc(total_len);
+    const_str = (char *)PerlMemShared_malloc(total_len ? total_len : 1);
 
     /* Extract all the non-const expressions from the concat tree then
      * dispose of the old tree, e.g. convert the tree from this: