[Freeswitch-trunk] [commit] r6668 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Tue Dec 11 15:32:41 EST 2007


Author: anthm
Date: Tue Dec 11 15:32:40 2007
New Revision: 6668

Modified:
   freeswitch/trunk/src/switch_utils.c

Log:
whatever

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Tue Dec 11 15:32:40 2007
@@ -1098,7 +1098,7 @@
 	size_t replace_len = strlen(replace);
 	size_t i, n;
 	size_t dest_len = 0;
-	char *dest;
+	char *dest, *tmp;
 
 	dest = (char *) malloc(sizeof(char));
 
@@ -1107,13 +1107,17 @@
 			for (n = 0; n < replace_len; n++) {
 				dest[dest_len] = replace[n];
 				dest_len++;
-				dest = (char *) realloc(dest, sizeof(char) * (dest_len + 1));
+				tmp = (char *) realloc(dest, sizeof(char) * (dest_len + 1));
+				switch_assert(tmp);
+				dest = tmp;
 			}
 			i += search_len - 1;
 		} else {
 			dest[dest_len] = string[i];
 			dest_len++;
-			dest = (char *) realloc(dest, sizeof(char) * (dest_len + 1));
+			tmp = (char *) realloc(dest, sizeof(char) * (dest_len + 1));
+			switch_assert(tmp);
+			dest = tmp;
 		}
 	}
 



More information about the Freeswitch-trunk mailing list