handle some error cases.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6879 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
f2eae66ebc
commit
53ce0c1f42
|
@ -356,7 +356,25 @@ static char *switch_xml_decode(char *s, char **ent, char t)
|
||||||
if (ent[b++]) { // found a match
|
if (ent[b++]) { // found a match
|
||||||
if ((c = (long) strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
|
if ((c = (long) strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
|
||||||
l = (d = (long) (s - r)) + c + (long) strlen(e); // new length
|
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
|
e = strchr((s = r + d), ';'); // fix up pointers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue