Module: sip-router
Branch: 4.0
Commit: 4471593e5f6e292d205bd84fb5912088bde32870
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4471593…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
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
(cherry picked from commit 6ff74701652a11497bd82ee3ba2ac7547d1ce666)
---
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... */