aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-06 15:33:15 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-06 15:33:15 +0000
commiteee2e227c9df2492521d7a4ed1ea0b987d88d1b8 (patch)
treed7f6f56f0ed83ee0ee6e103156bb1fe4ae6dd858 /channels/chan_sip.c
parentd10ab9a529eef6441ed8ce674c22b86c7a653d33 (diff)
This fixes a crash when LOW_MEMORY is turned on. Two allocations of the ast_rtp struct that were previously allocated on the stack have been modified to use thread local storage instead.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@120863 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6a3619ae7..50a7f4381 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1194,6 +1194,8 @@ static void temp_pvt_cleanup(void *);
/*! \brief A per-thread temporary pvt structure */
AST_THREADSTORAGE_CUSTOM(ts_temp_pvt, temp_pvt_init, temp_pvt_cleanup);
+AST_THREADSTORAGE(ast_rtp_buf, ast_rtp_buf_init);
+
/*! \todo Move the sip_auth list to AST_LIST */
static struct sip_auth *authl = NULL; /*!< Authentication list for realm authentication */
@@ -5060,12 +5062,20 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
}
/* Initialize the temporary RTP structures we use to evaluate the offer from the peer */
+#ifdef LOW_MEMORY
+ newaudiortp = ast_threadstorage_get(&ast_rtp_buf, ast_rtp_alloc_size());
+#else
newaudiortp = alloca(ast_rtp_alloc_size());
+#endif
memset(newaudiortp, 0, ast_rtp_alloc_size());
ast_rtp_new_init(newaudiortp);
ast_rtp_pt_clear(newaudiortp);
+#ifdef LOW_MEMORY
+ newvideortp = ast_threadstorage_get(&ast_rtp_buf, ast_rtp_alloc_size());
+#else
newvideortp = alloca(ast_rtp_alloc_size());
+#endif
memset(newvideortp, 0, ast_rtp_alloc_size());
ast_rtp_new_init(newvideortp);
ast_rtp_pt_clear(newvideortp);