#17747 caused bad free()s with PERL_DESTRUCT by calling newXS()
Hugo van der Sanden [Fri, 23 Aug 2002 12:23:31 +0000 (12:23 +0000)]
with a NULL subaddr. Fix that, and stop it happening again.

p4raw-id: //depot/perl@17763

op.c
universal.c

diff --git a/op.c b/op.c
index 043f0be..5c55f0d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5217,6 +5217,9 @@ Perl_newXS(pTHX_ char *name, XSUBADDR_t subaddr, char *filename)
                        GV_ADDMULTI, SVt_PVCV);
     register CV *cv;
 
+    if (!subaddr)
+       Perl_croak(aTHX_ "panic: no address for '%s' in '%s'", name, filename);
+
     if ((cv = (name ? GvCV(gv) : Nullcv))) {
        if (GvCVGEN(gv)) {
            /* just a cached method */
index 668fa3b..4a879e9 100644 (file)
@@ -192,7 +192,6 @@ Perl_boot_core_UNIVERSAL(pTHX)
        sv_inc(sv);
        SvSETMAGIC(sv);
        /* Make it findable via fetchmethod */
-       newXS("version::()", NULL, file);
        newXS("version::new", XS_version_new, file);
        newXS("version::(\"\"", XS_version_stringify, file);
        newXS("version::stringify", XS_version_stringify, file);