[asterisk-commits] file: trunk r83758 - /trunk/res/ael/pval.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 25 08:41:02 CDT 2007


Author: file
Date: Tue Sep 25 08:41:02 2007
New Revision: 83758

URL: http://svn.digium.com/view/asterisk?view=rev&rev=83758
Log:
Fix minor memory leak in pval.c. Overwriting a value without freeing the previous result is bad, mmmk?

Modified:
    trunk/res/ael/pval.c

Modified: trunk/res/ael/pval.c
URL: http://svn.digium.com/view/asterisk/trunk/res/ael/pval.c?view=diff&rev=83758&r1=83757&r2=83758
==============================================================================
--- trunk/res/ael/pval.c (original)
+++ trunk/res/ael/pval.c Tue Sep 25 08:41:02 2007
@@ -3144,7 +3144,6 @@
 				strncat(buf2,strp2+1, sizeof(buf2)-strlen(strp2+1)-2);
 				strcat(buf2,"]");
 				for_init->appargs = strdup(buf2);
-				for_init->app = strdup("Set");
 			} else {
 				strp2 = p->u1.for_init;
 				while (*strp2 && isspace(*strp2))
@@ -3166,7 +3165,7 @@
 						*strp3 = 0; /* remove the closing paren */
 
 					for_init->appargs = strdup(buf2);
-
+					free(for_init->app);
 					for_init->app = strdup("Macro");
 				} else {  /* must be a regular app call */
 					char *strp3;
@@ -3174,6 +3173,7 @@
 					strp3 = strchr(buf2,'(');
 					if (strp3) {
 						*strp3 = 0;
+						free(for_init->app);
 						for_init->app = strdup(buf2);
 						for_init->appargs = strdup(strp3+1);
 						strp3 = strrchr(for_init->appargs, ')');




More information about the asterisk-commits mailing list