X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=miniperlmain.c;h=601008719fb0cc200f364272d989c01fdc2fa80d;hb=2f4077cae90c079044b2ad3d07aafb29b5ebd47b;hp=53ab9475371dcf0a5421c900696817a75f37b28b;hpb=27da23d53ccce622bc51822f59df8def79b4df95;p=p5sagit%2Fp5-mst-13.2.git diff --git a/miniperlmain.c b/miniperlmain.c index 53ab947..6010087 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -101,11 +101,24 @@ main(int argc, char **argv, char **env) exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL); if (!exitstatus) perl_run(my_perl); - + exitstatus = perl_destruct(my_perl); perl_free(my_perl); +#if defined(USE_ENVIRON_ARRAY) && defined(PERL_TRACK_MEMPOOL) + /* + * The old environment may have been freed by perl_free() + * when PERL_TRACK_MEMPOOL is defined, but without having + * been restored by perl_destruct() before (this is only + * done if destruct_level > 0). + * + * It is important to have a valid environment for atexit() + * routines that are eventually called. + */ + environ = env; +#endif + #ifdef PERL_GLOBAL_STRUCT free_global_struct(plvarsp); #endif /* PERL_GLOBAL_STRUCT */ @@ -123,5 +136,16 @@ main(int argc, char **argv, char **env) static void xs_init(pTHX) { + PERL_UNUSED_CONTEXT; dXSUB_SYS; } + +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * + * ex: set ts=8 sts=4 sw=4 noet: + */