The attached patch stops mod_perl-1.x from calling av_undef() on a NULL AV*.

This fixes some horrible nastiness when using bleadperl, which no longer returns early from av_undef() in the case that the AV* is NULL as of perl change #26513.

Would someone please be kind enough to take a quick look and +1 it if looks OK before I commit?

(mod_perl-2.x seems not to use av_undef() anywhere, so no similar change will be required there.)

--
Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c (revision 553245)
+++ src/modules/perl/mod_perl.c (working copy)
@@ -277,13 +277,17 @@
 
     mp_request_rec = 0;
 
-    av_undef(orig_inc);
-    SvREFCNT_dec((SV*)orig_inc);
-    orig_inc = Nullav;
+    if (orig_inc != Nullav) {
+       av_undef(orig_inc);
+       SvREFCNT_dec((SV*)orig_inc);
+       orig_inc = Nullav;
+    }
 
-    av_undef(cleanup_av);
-    SvREFCNT_dec((SV*)cleanup_av);
-    cleanup_av = Nullav;
+    if (cleanup_av != Nullav) {
+       av_undef(cleanup_av);
+       SvREFCNT_dec((SV*)cleanup_av);
+       cleanup_av = Nullav;
+    }
 
 #ifdef PERL_STACKED_HANDLERS
     hv_undef(stacked_handlers);
@@ -1159,9 +1163,11 @@
     perl_clear_env();
 
     /* reset @INC */
-    av_undef(GvAV(incgv));
-    SvREFCNT_dec(GvAV(incgv));
-    GvAV(incgv) = Nullav;
+    if (GvAV(incgv) != Nullav) {
+       av_undef(GvAV(incgv));
+       SvREFCNT_dec(GvAV(incgv));
+       GvAV(incgv) = Nullav;
+    }
     GvAV(incgv) = av_copy_array(orig_inc);
 
     /* reset $/ */
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to