[Freeswitch-branches] [commit] r3317 - freeswitch/branches/knhor/trunk/src

Freeswitch SVN knhor at freeswitch.org
Sat Nov 11 18:20:26 EST 2006


Author: knhor
Date: Sat Nov 11 18:20:25 2006
New Revision: 3317

Modified:
   freeswitch/branches/knhor/trunk/src/switch_event.c

Log:
Merged revisions 3315-3316 via svnmerge from trunk


Modified: freeswitch/branches/knhor/trunk/src/switch_event.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_event.c	(original)
+++ freeswitch/branches/knhor/trunk/src/switch_event.c	Sat Nov 11 18:20:25 2006
@@ -615,8 +615,14 @@
 		llen = strlen(hp->name) + strlen(hp->value) + 2;
 		
 		if ((len + llen) > dlen) {
+			char *m;
 			dlen += (blocksize + (len + llen));
-			buf = realloc(buf, dlen);
+			if ((m = realloc(buf, dlen))) {
+				buf = m;
+			} else {
+				switch_safe_free(buf);
+				return SWITCH_STATUS_MEMERR;
+			}
 		}
 
 		snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, hp->value);
@@ -634,10 +640,16 @@
 		}
 		
 		if ((len + llen) > dlen) {
+			char *m;
 			dlen += (blocksize + (len + llen));
-			buf = realloc(buf, dlen);
+			if ((m = realloc(buf, dlen))) {
+				buf = m;
+			} else {
+				switch_safe_free(buf);
+				return SWITCH_STATUS_MEMERR;
+			}
 		}
-
+		
 		if (blen) {
 			snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", blen, event->body);
 		} else {



More information about the Freeswitch-branches mailing list