]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merge r377258 for 10.11.0-digiumphones-rc2
authorAsterisk Autobuilder <asteriskteam@digium.com>
Wed, 5 Dec 2012 17:51:47 +0000 (17:51 +0000)
committerAsterisk Autobuilder <asteriskteam@digium.com>
Wed, 5 Dec 2012 17:51:47 +0000 (17:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/tags/10.11.0-digiumphones-rc2@377296 65c4cc65-6c06-0410-ace0-fbb531ad65f3

.version
ChangeLog
channels/chan_sip.c

index 37def90bbd002de309e4bfdf42c0793379c40db5..351e5db90b5f1af0c4fa201907bd9389f72e4dc8 100644 (file)
--- a/.version
+++ b/.version
@@ -1 +1 @@
-10.11.0-digiumphones-rc1
+10.11.0-digiumphones-rc2
index 5f317f00dd47f045bd39593ce2a7616cd7f99bd9..02b2e32f73a08292a1db700a5b84c06c2ddd507f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2012-12-05  Asterisk Development Team <asteriskteam@digium.com>
+
+       * Asterisk 10.11.0-digiumphones-rc2 Released.
+
+       * Fix a SIP request memory leak with TLS connections.
+
+       During the TLS re-work in chan_sip some TLS specific code was moved
+       into a separate function. This function operates on a copy of the
+       incoming SIP request. This copy was never deinitialized causing a
+       memory leak for each request processed.
+
+       This function is now given a SIP request structure which it can use
+       to copy the incoming request into. This reduces the amount of memory
+       allocations done since the internal allocated components are reused
+       between packets and also ensures the SIP request structure is
+       deinitialized when the TLS connection is torn down.
+
+       (closes issue ASTERISK-20763)
+       Reported by: deti
+
 2012-11-06  Asterisk Development Team <asteriskteam@digium.com>
 
        * Asterisk 10.11.0-digiumphones-rc1 Released.
index f95191e1429e7bba5b39afd2e0aa6d5d73cb9032..c72f98606650da4f21cd33f6e1ffe422790b8425 100644 (file)
@@ -2561,10 +2561,10 @@ static int sip_check_authtimeout(time_t start)
  * \retval -1 Failed to read data
  * \retval 0 Succeeded in reading data
  */
-static int sip_tls_read(struct sip_request *req, struct ast_tcptls_session_instance *tcptls_session, int authenticated, time_t start, struct sip_threadinfo *me)
+static int sip_tls_read(struct sip_request *req, struct sip_request *reqcpy, struct ast_tcptls_session_instance *tcptls_session,
+                       int authenticated, time_t start, struct sip_threadinfo *me)
 {
        int res, content_length, after_poll = 1, need_poll = 1;
-       struct sip_request reqcpy = { 0, };
        char buf[1024] = "";
        int timeout = -1;
 
@@ -2618,10 +2618,10 @@ static int sip_tls_read(struct sip_request *req, struct ast_tcptls_session_insta
                }
                ast_str_append(&req->data, 0, "%s", buf);
        }
-       copy_request(&reqcpy, req);
-       parse_request(&reqcpy);
+       copy_request(reqcpy, req);
+       parse_request(reqcpy);
        /* In order to know how much to read, we need the content-length header */
-       if (sscanf(sip_get_header(&reqcpy, "Content-Length"), "%30d", &content_length)) {
+       if (sscanf(sip_get_header(reqcpy, "Content-Length"), "%30d", &content_length)) {
                while (content_length > 0) {
                        size_t bytes_read;
                        if (!tcptls_session->client && !authenticated) {
@@ -3035,7 +3035,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
                        req.socket.fd = tcptls_session->fd;
 
                        if (tcptls_session->ssl) {
-                               res = sip_tls_read(&req, tcptls_session, authenticated, start, me);
+                               res = sip_tls_read(&req, &reqcpy, tcptls_session, authenticated, start, me);
                        } else {
                                res = sip_tcp_read(&req, tcptls_session, authenticated, start);
                        }