[Asterisk-cvs] asterisk asterisk.c,1.25,1.26 cli.c,1.12,1.13

markster at lists.digium.com markster at lists.digium.com
Sun Nov 9 13:07:26 CST 2003


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv21542

Modified Files:
	asterisk.c cli.c 
Log Message:
CLI memory leak patch


Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- asterisk.c	22 Oct 2003 03:46:36 -0000	1.25
+++ asterisk.c	9 Nov 2003 19:33:39 -0000	1.26
@@ -949,6 +949,7 @@
 
 	if (matches) {
 		int i;
+		int x;
 		int matches_num, maxlen, match_len;
 
 		if (matches[0][0] != '\0') {
@@ -978,6 +979,10 @@
 				retval = CC_REFRESH;
 			}
 		}
+	for (x=0; matches[x]; x++) {
+		free(matches[x]);
+		matches[x] = NULL;
+	}
 	free(matches);
 	}
 

Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cli.c	22 Oct 2003 04:03:15 -0000	1.12
+++ cli.c	9 Nov 2003 19:33:39 -0000	1.13
@@ -864,12 +864,14 @@
 
 	while ( (buf = ast_cli_generator(text, word, i)) ) {
 		if (++i > 1 && strcmp(buf,oldbuf) == 0)  {
+				free(buf);
 				continue;
 		}
 		oldbuf = buf;
 		matches++;
 	}
-
+	free(oldbuf);
+	free(buf);
 	return matches;
 }
 




More information about the svn-commits mailing list