diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2009-06-25 22:57:46 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-06-25 22:57:46 +0200 |
commit | 31c91b4357905486e81f901ad079da5735bdb7ba (patch) | |
tree | d6caeb0b0d3db61a19404bb65574adb8cc9029a5 /perl.c | |
parent | 05b4f1ece255de95efcc5a4c74e28b5d04f54401 (diff) | |
download | perl-31c91b4357905486e81f901ad079da5735bdb7ba.tar.gz |
Don't enqueue pending signals during global destruction
Global destruction is not signal-safe. PL_psig_pend may already
be gone when the signal handler is called (with destruct_level > 0).
NULL it before freeing it to prevent a race condition.
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1233,6 +1233,13 @@ perl_destruct(pTHXx) PL_psig_ptr = (SV**)NULL; Safefree(PL_psig_pend); PL_psig_pend = (int*)NULL; + { + /* We need to NULL PL_psig_pend first, so that + signal handlers know not to use it */ + int *psig_save = PL_psig_pend; + PL_psig_pend = (int*)NULL; + Safefree(psig_save); + } PL_formfeed = NULL; nuke_stacks(); PL_tainting = FALSE; |