提交 36320b92 authored 作者: Michael Jerris's avatar Michael Jerris

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
上级 efd78441
......@@ -863,11 +863,14 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch
ret = vasprintf(&data, fmt, ap);
#else
data = (char *) malloc(2048);
switch_assert(data);
if (!data) return NULL;
ret = vsnprintf(data, 2048, fmt, ap);
#endif
va_end(ap);
if (ret == -1) {
#ifndef HAVE_VASPRINTF
free(data);
#endif
return NULL;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论