[sr-dev] git:3.3: perl: move initialization of SIP message var after initialization of temporary environment

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 25 11:48:18 CEST 2013


Module: sip-router
Branch: 3.3
Commit: fe571b1cc75132994fb94879e294dfc79c2e2787
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fe571b1cc75132994fb94879e294dfc79c2e2787

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Jul 25 11:47:12 2013 +0200

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
- backport from master commit 6ff74701652a11497bd82ee3ba2ac7547d1ce666

---

 modules_k/perl/perlfunc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules_k/perl/perlfunc.c b/modules_k/perl/perlfunc.c
index f65b9c0..9684a0d 100644
--- a/modules_k/perl/perlfunc.c
+++ b/modules_k/perl/perlfunc.c
@@ -127,16 +127,16 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) {
 		return -1;
 	}
 
-	m = sv_newmortal();
-	sv_setref_pv(m, "OpenSER::Message", (void *)_msg);
-	SvREADONLY_on(SvRV(m));
-
 
 	ENTER;				/* everything created after here */
 	SAVETMPS;			/* ...is a temporary variable.   */
 	PUSHMARK(SP);			/* remember the stack pointer    */
 	XPUSHs(m);			/* Our reference to the stack... */
 
+	m = sv_newmortal();
+	sv_setref_pv(m, "OpenSER::Message", (void *)_msg);
+	SvREADONLY_on(SvRV(m));
+
 	if (mystr)
 		XPUSHs(sv_2mortal(newSVpv(mystr, strlen(mystr))));
 					/* Our string to the stack... */




More information about the sr-dev mailing list