diff --git a/plugins/psgi/psgi_plugin.c b/plugins/psgi/psgi_plugin.c index b6dc29cd..93960531 100644 --- a/plugins/psgi/psgi_plugin.c +++ b/plugins/psgi/psgi_plugin.c @@ -708,6 +708,9 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) { if (SvTRUE(*harakiri)) wsgi_req->async_plagued = 1; } + // Free the $env hash + SvREFCNT_dec(wsgi_req->async_environ); + // async plagued could be defined in other areas... if (wsgi_req->async_plagued) { uwsgi_log("*** psgix.harakiri.commit requested ***\n"); @@ -717,9 +720,6 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) { goodbye_cruel_world(); } - // clear the env - SvREFCNT_dec(wsgi_req->async_environ); - // now we can check for changed files if (uperl.auto_reload) { time_t now = uwsgi_now(); @@ -854,7 +854,6 @@ void uwsgi_perl_run_hook(SV *hook) { static void uwsgi_perl_atexit() { int i; - struct wsgi_request *wsgi_req = current_wsgi_req(); if (uwsgi.mywid == 0) goto realstuff; @@ -876,10 +875,6 @@ destroyperl: for(i=0;iasync_environ); - // Destroy the PerlInterpreter, see "perldoc perlembed" perl_destruct(uperl.main[i]); perl_free(uperl.main[i]);