Module: sip-router Branch: master Commit: 6ff74701652a11497bd82ee3ba2ac7547d1ce666 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6ff74701652a11497bd82ee3ba2ac7547d1ce666
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: Thu Jul 25 10:14:55 2013 +0200 app_perl: move initialization of SIP message var after initialization of temporary environment - upon a report by David Cunningham of a leak in operating system memory --- modules/app_perl/perlfunc.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/app_perl/perlfunc.c b/modules/app_perl/perlfunc.c index 96f7596..90a80d4 100644 --- a/modules/app_perl/perlfunc.c +++ b/modules/app_perl/perlfunc.c @@ -127,16 +127,15 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) { return -1; } - m = sv_newmortal(); - sv_setref_pv(m, "Kamailio::Message", (void *)_msg); - SvREADONLY_on(SvRV(m)); - - ENTER; /* everything created after here */ SAVETMPS; /* ...is a temporary variable. */ - PUSHMARK(SP); /* remember the stack pointer */ + PUSHMARK(SP); /* remember the stack pointer */ XPUSHs(m); /* Our reference to the stack... */ + m = sv_newmortal(); + sv_setref_pv(m, "Kamailio::Message", (void *)_msg); + SvREADONLY_on(SvRV(m)); + if (mystr) XPUSHs(sv_2mortal(newSVpv(mystr, strlen(mystr)))); /* Our string to the stack... */ _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
