This patch fixes three memory leaks
* When we load a module with the LOAD_PRIORITY flag, we remove its entry from
the load order list. Unfortunately, we don't free the memory associated with
entry in the list. This patch corrects that and properly frees the memory
for the module in the list.
* When adding a custom format (such as SILK or CELT), the routine for adding
the format was leaking a reference. RAII_VAR cleans this up properly.
* We now de-ref the channel_snapshot appropriately when an endpoint is
disposed of
........
Merged revisions 391489 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 391507 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391521
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
ao2_cleanup(endpoint->topic);
endpoint->topic = NULL;
+ ao2_cleanup(endpoint->channel_ids);
+ endpoint->channel_ids = NULL;
+
ast_string_field_free_memory(endpoint);
}
RAII_VAR(char *, channel_id, obj, ao2_cleanup);
snapshot->channel_ids[snapshot->num_channels++] = channel_id;
}
+ ao2_iterator_destroy(&i);
ao2_ref(snapshot, +1);
return snapshot;
static int format_list_add_custom(struct ast_format_list *new)
{
- struct ast_format_list *entry;
+ RAII_VAR(struct ast_format_list *, entry, NULL, ao2_cleanup);
if (!(entry = ao2_alloc(sizeof(*entry), NULL))) {
return -1;
}
break;
case AST_MODULE_LOAD_PRIORITY:
AST_LIST_REMOVE_CURRENT(entry);
+ ast_free(order->resource);
+ ast_free(order);
break;
}
}