Fix to work with perl-5.10, from mod_perl SVN repository at
http://svn.apache.org/viewvc?view=rev&revision=555908

Log message:
Don't call av_undef() on a NULL AV*.

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

$OpenBSD: patch-src_modules_perl_mod_perl_c,v 1.4 2008/10/11 10:58:59 simon Exp $
--- src/modules/perl/mod_perl.c.orig	Sat Oct 11 11:04:09 2008
+++ src/modules/perl/mod_perl.c	Sat Oct 11 11:05:42 2008
@@ -277,14 +277,9 @@ void perl_shutdown (server_rec *s, pool *p)
 
     mp_request_rec = 0;
 
-    av_undef(orig_inc);
-    SvREFCNT_dec((SV*)orig_inc);
-    orig_inc = Nullav;
+    MP_safe_av_undef(orig_inc)
+    MP_safe_av_undef(cleanup_av)
 
-    av_undef(cleanup_av);
-    SvREFCNT_dec((SV*)cleanup_av);
-    cleanup_av = Nullav;
-
 #ifdef PERL_STACKED_HANDLERS
     hv_undef(stacked_handlers);
     SvREFCNT_dec((SV*)stacked_handlers);
@@ -1159,9 +1154,7 @@ void mod_perl_end_cleanup(void *data)
     perl_clear_env();
 
     /* reset @INC */
-    av_undef(GvAV(incgv));
-    SvREFCNT_dec(GvAV(incgv));
-    GvAV(incgv) = Nullav;
+    MP_safe_av_undef(GvAV(incgv))
     GvAV(incgv) = av_copy_array(orig_inc);
 
     /* reset $/ */
