summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2016-08-14 23:35:23 +0200
committerGitHub <noreply@github.com>2016-08-14 23:35:23 +0200
commitc284309d36dfa620faae5dad66a3aba78d8ad17a (patch)
tree501643086bdc4eb7b345be5cf210430e8cf622d5
parent61fa6eb35b065299e76456a3b20e6f17d15b5016 (diff)
parentb411f943a081b7c7fde0548f8c7ee5e93c0638a9 (diff)
downloadirssi-c284309d36dfa620faae5dad66a3aba78d8ad17a.zip
Merge pull request #525 from ailin-nemui/issue522
fix use after free in expando error
-rw-r--r--src/perl/common/Expando.xs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/perl/common/Expando.xs b/src/perl/common/Expando.xs
index e8e8f751..bb5d185b 100644
--- a/src/perl/common/Expando.xs
+++ b/src/perl/common/Expando.xs
@@ -74,15 +74,18 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
ret = NULL;
if (SvTRUE(ERRSV)) {
+ PERL_SCRIPT_REC *script = rec->script;
+
(void) POPs;
/* call putback before emitting script error signal as that
* could manipulate the perl stack. */
PUTBACK;
/* make sure we don't get back here */
- if (rec->script != NULL)
- script_unregister_expandos(rec->script);
+ if (script != NULL)
+ script_unregister_expandos(script);
+ /* rec has been freed now */
- signal_emit("script error", 2, rec->script, SvPV_nolen(ERRSV));
+ signal_emit("script error", 2, script, SvPV_nolen(ERRSV));
} else if (retcount > 0) {
ret = g_strdup(POPp);
*free_ret = TRUE;