[Freeswitch-svn] [commit] r6879 - freeswitch/trunk/src
Freeswitch SVN
mikej at freeswitch.org
Tue Dec 18 16:37:29 EST 2007
Author: mikej
Date: Tue Dec 18 16:37:28 2007
New Revision: 6879
Modified:
freeswitch/trunk/src/switch_xml.cpp
Log:
handle some error cases.
Modified: freeswitch/trunk/src/switch_xml.cpp
==============================================================================
--- freeswitch/trunk/src/switch_xml.cpp (original)
+++ freeswitch/trunk/src/switch_xml.cpp Tue Dec 18 16:37:28 2007
@@ -356,7 +356,25 @@
if (ent[b++]) { // found a match
if ((c = (long) strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
l = (d = (long) (s - r)) + c + (long) strlen(e); // new length
- r = (r == m) ? strcpy((char *)malloc(l), r) : (char *)realloc(r, l);
+ if (l) {
+ if (r == m) {
+ char *tmp = (char *)malloc(l);
+ if (tmp) {
+ r = strcpy(tmp, r);
+ } else {
+ if (r) free(r);
+ return NULL;
+ }
+ } else {
+ char *tmp = (char *)realloc(r, l);
+ if (tmp) {
+ r = tmp;
+ } else {
+ if (r) free(r);
+ return NULL;
+ }
+ }
+ }
e = strchr((s = r + d), ';'); // fix up pointers
}
More information about the Freeswitch-svn
mailing list