Browse Source

app_perl: push the sip msg structure to perl after initializing it

- reported by David Cunningham
Daniel-Constantin Mierla 12 years ago
parent
commit
341f810dca
1 changed files with 2 additions and 1 deletions
  1. 2 1
      modules/app_perl/perlfunc.c

+ 2 - 1
modules/app_perl/perlfunc.c

@@ -130,12 +130,13 @@ int perl_exec2(struct sip_msg* _msg, char* fnc, char* mystr) {
 	ENTER;				/* everything created after here */
 	ENTER;				/* everything created after here */
 	SAVETMPS;			/* ...is a temporary variable.   */
 	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();
 	m = sv_newmortal();
 	sv_setref_pv(m, "Kamailio::Message", (void *)_msg);
 	sv_setref_pv(m, "Kamailio::Message", (void *)_msg);
 	SvREADONLY_on(SvRV(m));
 	SvREADONLY_on(SvRV(m));
 
 
+	XPUSHs(m);			/* Our reference to the stack... */
+
 	if (mystr)
 	if (mystr)
 		XPUSHs(sv_2mortal(newSVpv(mystr, strlen(mystr))));
 		XPUSHs(sv_2mortal(newSVpv(mystr, strlen(mystr))));
 					/* Our string to the stack... */
 					/* Our string to the stack... */