Under 5.005 threads and debugging crashed in Debian 2.2 Linux/x86
Jarkko Hietaniemi [Tue, 16 Jan 2001 03:42:55 +0000 (03:42 +0000)]
at the setting of the ofs_sv in new_struct_thread() as the
thr->Tofs_sv (PL_ofs_sv) was still 0xabab.... (this is what
uninitialized fields are, uh, initialized with),
SvREFCNT_inc()ing that invited a core dump.

p4raw-id: //depot/perl@8449

util.c

diff --git a/util.c b/util.c
index 27c6953..b163b05 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3645,9 +3645,9 @@ Perl_new_struct_thread(pTHX_ struct perl_thread *t)
     PL_tainted = t->Ttainted;
     PL_curpm = t->Tcurpm;         /* XXX No PMOP ref count */
     PL_nrs = newSVsv(t->Tnrs);
-    PL_rs = SvREFCNT_inc(PL_nrs);
+    PL_rs = t->Tnrs ? SvREFCNT_inc(PL_nrs) : Nullsv;
     PL_last_in_gv = Nullgv;
-    PL_ofs_sv = SvREFCNT_inc(PL_ofs_sv);
+    PL_ofs_sv = t->Tofs_sv ? SvREFCNT_inc(PL_ofs_sv) : Nullsv;
     PL_defoutgv = (GV*)SvREFCNT_inc(t->Tdefoutgv);
     PL_chopset = t->Tchopset;
     PL_bodytarget = newSVsv(t->Tbodytarget);