mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-10 03:48:34 +00:00
Fix incorrect usages of ast_realloc().
There are several locations in the code base where this is done: buf = ast_realloc(buf, new_size); This is going to leak the original buf contents if the realloc fails. Review: https://reviewboard.asterisk.org/r/2832/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@398757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1175,13 +1175,17 @@ int ast_event_append_ie_raw(struct ast_event **event, enum ast_event_ie_type ie_
|
||||
const void *data, size_t data_len)
|
||||
{
|
||||
struct ast_event_ie *ie;
|
||||
struct ast_event *old_event;
|
||||
unsigned int extra_len;
|
||||
uint16_t event_len;
|
||||
|
||||
event_len = ntohs((*event)->event_len);
|
||||
extra_len = sizeof(*ie) + data_len;
|
||||
|
||||
if (!(*event = ast_realloc(*event, event_len + extra_len))) {
|
||||
old_event = *event;
|
||||
*event = ast_realloc(*event, event_len + extra_len);
|
||||
if (!*event) {
|
||||
ast_free(old_event);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user