summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-19 11:20:08 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-19 11:20:08 +0000
commit07fcac018384bd37bd2822ab8745344861c7c3df (patch)
tree18e53f1068245d816ba9e06cf060ea6aab2e1507
parent33f36c7173d6dd43ce4e6d15c3d8b88b5652cdfd (diff)
downloadperl-07fcac018384bd37bd2822ab8745344861c7c3df.tar.gz
newCONSTSUB needs to be robust in case CopFILE is NULL.
p4raw-id: //depot/perl@27901
-rw-r--r--op.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/op.c b/op.c
index 8efe3b250c..ec4cb3a8bd 100644
--- a/op.c
+++ b/op.c
@@ -5399,13 +5399,13 @@ Perl_newCONSTSUB(pTHX_ HV *stash, const char *name, SV *sv)
CV* cv;
#ifdef USE_ITHREADS
const char *const temp_p = CopFILE(PL_curcop);
- const STRLEN len = strlen(temp_p);
+ const STRLEN len = temp_p ? strlen(temp_p) : 0;
#else
SV *const temp_sv = CopFILESV(PL_curcop);
STRLEN len;
const char *const temp_p = temp_sv ? SvPV_const(temp_sv, len) : NULL;
#endif
- char *const file = temp_p ? savepvn(temp_p, len) : NULL;
+ char *const file = savepvn(temp_p, temp_p ? len : 0);
ENTER;