don't use uninitialized value of data, return error if null fmt string passed.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4116 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-02-04 19:12:14 +00:00
parent 357acc8117
commit df7ce0d951
1 changed files with 7 additions and 5 deletions

View File

@ -531,13 +531,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, cha
ret = vsnprintf(data, 2048, fmt, ap);
#endif
va_end(ap);
}
if (ret == -1) {
return SWITCH_STATUS_GENERR;
if (ret == -1) {
return SWITCH_STATUS_GENERR;
} else {
event->body = data;
return SWITCH_STATUS_SUCCESS;
}
} else {
event->body = data;
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_GENERR;
}
}