forked from Mirrors/freeswitch
handle edgecase leak on platforms without vasprintf. Found by Klockwork (www.klocwork.com)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8445 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
efd78441d6
commit
36320b9248
@ -863,11 +863,14 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch
|
|||||||
ret = vasprintf(&data, fmt, ap);
|
ret = vasprintf(&data, fmt, ap);
|
||||||
#else
|
#else
|
||||||
data = (char *) malloc(2048);
|
data = (char *) malloc(2048);
|
||||||
switch_assert(data);
|
if (!data) return NULL;
|
||||||
ret = vsnprintf(data, 2048, fmt, ap);
|
ret = vsnprintf(data, 2048, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
|
#ifndef HAVE_VASPRINTF
|
||||||
|
free(data);
|
||||||
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user