From 0622cbe8d82835bbb746de7c1f12fbf9df485b10 Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Tue, 10 Apr 2012 19:57:30 +0000 Subject: [PATCH] Fix crash caused by unloading or reloading of res_http_post When unlinking itself from the registered HTTP URIs, res_http_post could inadvertently free all URIs registered with the HTTP server. This patch modifies the unregister method to only free the URI that is actually being unregistered, as opposed to all of them. ........ Merged revisions 361803 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@361804 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/http.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main/http.c b/main/http.c index c7e3ceb15a..5bbeca33ee 100644 --- a/main/http.c +++ b/main/http.c @@ -581,12 +581,12 @@ void ast_http_uri_unlink_all_with_key(const char *key) AST_RWLIST_TRAVERSE_SAFE_BEGIN(&uris, urih, entry) { if (!strcmp(urih->key, key)) { AST_RWLIST_REMOVE_CURRENT(entry); - } - if (urih->dmallocd) { - ast_free(urih->data); - } - if (urih->mallocd) { - ast_free(urih); + if (urih->dmallocd) { + ast_free(urih->data); + } + if (urih->mallocd) { + ast_free(urih); + } } } AST_RWLIST_TRAVERSE_SAFE_END; -- 2.47.2