From: Matthew Jordan Date: Tue, 10 Apr 2012 19:57:06 +0000 (+0000) Subject: Fix crash caused by unloading or reloading of res_http_post X-Git-Tag: 1.8.13.0-rc1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40beb62845f04b4d4248b1be08b162c19daf4327;p=thirdparty%2Fasterisk.git 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@361803 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/http.c b/main/http.c index 88e36c7a1f..9fb00721f6 100644 --- a/main/http.c +++ b/main/http.c @@ -582,12 +582,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;