summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b73b6b5)
(closes issue #13230)
Reported by: eliel
Patches:
res_http_post_leak.patch uploaded by eliel (license 64)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135476
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
unsigned int supports_get:1;
/*! This handler accepts POST requests */
unsigned int supports_post:1;
unsigned int supports_get:1;
/*! This handler accepts POST requests */
unsigned int supports_post:1;
+ /*! Structure is malloc'd */
+ unsigned int mallocd:1;
+ /*! Data structure is malloc'd */
+ unsigned int dmallocd:1;
/*! Data to bind to the uri if needed */
void *data;
/*! Data to bind to the uri if needed */
void *data;
- /*! Key to be used for unlinking if multipile URIs registerd */
+ /*! Key to be used for unlinking if multiple URIs registered */
if (!strcmp(urih->key, key)) {
AST_RWLIST_REMOVE_CURRENT(entry);
}
if (!strcmp(urih->key, key)) {
AST_RWLIST_REMOVE_CURRENT(entry);
}
+ if (urih->dmallocd) {
+ ast_free(urih->data);
+ }
+ if (urih->mallocd) {
+ ast_free(urih);
+ }
}
AST_RWLIST_TRAVERSE_SAFE_END
AST_RWLIST_UNLOCK(&uris);
}
AST_RWLIST_TRAVERSE_SAFE_END
AST_RWLIST_UNLOCK(&uris);
struct ast_str *ds;
if (!(urih = ast_calloc(sizeof(*urih), 1))) {
struct ast_str *ds;
if (!(urih = ast_calloc(sizeof(*urih), 1))) {
+ ast_config_destroy(cfg);
- if (!(ds = ast_str_create(32)))
+ if (!(ds = ast_str_create(32))) {
+ ast_free(urih);
+ ast_config_destroy(cfg);
urih->description = ast_strdup("HTTP POST mapping");
urih->uri = ast_strdup(v->name);
urih->description = ast_strdup("HTTP POST mapping");
urih->uri = ast_strdup(v->name);
urih->supports_post = 1;
urih->callback = http_post_callback;
urih->key = __FILE__;
urih->supports_post = 1;
urih->callback = http_post_callback;
urih->key = __FILE__;
+ urih->mallocd = urih->dmallocd = 1;
ast_http_uri_link(urih);
}
ast_http_uri_link(urih);
}
static int reload(void)
{
static int reload(void)
{
__ast_http_post_load(1);
return AST_MODULE_LOAD_SUCCESS;
__ast_http_post_load(1);
return AST_MODULE_LOAD_SUCCESS;