Browse code

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

Daniel-Constantin Mierla authored on 25/07/2013 09:47:12
Showing 1 changed files
... ...
@@ -127,16 +127,16 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) {
127 127
 		return -1;
128 128
 	}
129 129
 
130
-	m = sv_newmortal();
131
-	sv_setref_pv(m, "OpenSER::Message", (void *)_msg);
132
-	SvREADONLY_on(SvRV(m));
133
-
134 130
 
135 131
 	ENTER;				/* everything created after here */
136 132
 	SAVETMPS;			/* ...is a temporary variable.   */
137 133
 	PUSHMARK(SP);			/* remember the stack pointer    */
138 134
 	XPUSHs(m);			/* Our reference to the stack... */
139 135
 
136
+	m = sv_newmortal();
137
+	sv_setref_pv(m, "OpenSER::Message", (void *)_msg);
138
+	SvREADONLY_on(SvRV(m));
139
+
140 140
 	if (mystr)
141 141
 		XPUSHs(sv_2mortal(newSVpv(mystr, strlen(mystr))));
142 142
 					/* Our string to the stack... */