diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-19 03:51:06 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-19 03:51:06 +0000 |
commit | 8ba0ffb3a4da29a17a665616cc02d27fa83a2152 (patch) | |
tree | ea1eece457ad8ab1481e417457279315680f3228 | |
parent | 75163e5c9fce718b266b54d134962c3fbc023597 (diff) |
Set req->data to NULL after free'ing to ensure that it never gets accidentally
double free'd. (reported by dhubbard directly to me)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@109833 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index ef0227ce0..43484ea36 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3100,6 +3100,7 @@ static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmitty __sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) : __sip_xmit(p, req->data, req->len); ast_free(req->data); + req->data = NULL; if (res > 0) return 0; return res; @@ -3133,8 +3134,10 @@ static int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittyp res = (reliable) ? __sip_reliable_xmit(p, seqno, 0, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) : __sip_xmit(p, req->data, req->len); - if (req->data) + if (req->data) { ast_free(req->data); + req->data = NULL; + } return res; } @@ -18102,6 +18105,7 @@ static int handle_request_do(struct sip_request *req, struct sockaddr_in *sin) if (req->headers < 2) { /* Must have at least two headers */ ast_free(req->data); + req->data = NULL; return 1; } |