]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
don't leak memory when a chan_sip thread is destroyed that has a thread-local temp_pv...
authorKevin P. Fleming <kpfleming@digium.com>
Wed, 18 Oct 2006 23:49:39 +0000 (23:49 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Wed, 18 Oct 2006 23:49:39 +0000 (23:49 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@45621 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 9475898eec195b868ee31b853e38454a7f5444ba..148a456a966736f5915c28f7cf49729c1119f3d6 100644 (file)
@@ -1146,8 +1146,10 @@ static struct ast_register_list {
        int recheck;
 } regl;
 
+static void temp_pvt_cleanup(void *);
+
 /*! \brief A per-thread temporary pvt structure */
-AST_THREADSTORAGE(ts_temp_pvt, temp_pvt_init);
+AST_THREADSTORAGE_CUSTOM(ts_temp_pvt, temp_pvt_init, temp_pvt_cleanup);
 
 /*! \todo Move the sip_auth list to AST_LIST */
 static struct sip_auth *authl = NULL;          /*!< Authentication list for realm authentication */
@@ -5562,6 +5564,13 @@ static int __transmit_response(struct sip_pvt *p, const char *msg, const struct
        return send_response(p, &resp, reliable, seqno);
 }
 
+static void temp_pvt_cleanup(void *data)
+{
+       struct sip_pvt *p = data;
+
+       ast_string_field_free_pools(p);
+}
+
 /*! \brief Transmit response, no retransmits, using a temporary pvt structure */
 static int transmit_response_using_temp(ast_string_field callid, struct sockaddr_in *sin, int useglobal_nat, const int intended_method, const struct sip_request *req, const char *msg)
 {