This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Some calls to PerlMemShared_alloc() aren't checking the return value.
[perl5.git] / util.c
diff --git a/util.c b/util.c
index 1892fec..030c706 100644 (file)
--- a/util.c
+++ b/util.c
@@ -803,6 +803,11 @@ Perl_savesharedpv(pTHX_ const char *pv)
     register char *newaddr = Nullch;
     if (pv) {
        newaddr = (char*)PerlMemShared_malloc(strlen(pv)+1);
+       if (!newaddr) {
+           PerlLIO_write(PerlIO_fileno(Perl_error_log),
+                         PL_no_mem, strlen(PL_no_mem));
+           my_exit(1);
+       }
        (void)strcpy(newaddr,pv);
     }
     return newaddr;