[sr-dev] git:master:2b427a33: core: fix leak in case of error to get boundary inside check_boundaries()
Daniel-Constantin Mierla
miconda at gmail.com
Thu Apr 28 22:43:24 CEST 2016
Module: kamailio
Branch: master
Commit: 2b427a33937c6a86ab231de39d5a4574309dbfc6
URL: https://github.com/kamailio/kamailio/commit/2b427a33937c6a86ab231de39d5a4574309dbfc6
Author: sergey-vb <sergey.v.basov at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-04-28T22:42:51+02:00
core: fix leak in case of error to get boundary inside check_boundaries()
- impacted setting multi-part body function
---
Modified: msg_translator.c
---
Diff: https://github.com/kamailio/kamailio/commit/2b427a33937c6a86ab231de39d5a4574309dbfc6.diff
Patch: https://github.com/kamailio/kamailio/commit/2b427a33937c6a86ab231de39d5a4574309dbfc6.patch
---
diff --git a/msg_translator.c b/msg_translator.c
index bc2c3b2..9441717 100644
--- a/msg_translator.c
+++ b/msg_translator.c
@@ -1688,7 +1688,8 @@ int get_boundary(struct sip_msg* msg, str* boundary)
msg->content_type->body.len);
if (params.s == NULL)
{
- LM_ERR("Content-Type hdr has no params\n");
+ LM_INFO("Content-Type hdr has no params <%.*s>\n",
+ msg->content_type->body.len, msg->content_type->body.s);
return -1;
}
params.len = msg->content_type->body.len -
@@ -1749,7 +1750,10 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info)
}
tmp.s = buf.s;
t = tmp.len = buf.len;
- if(get_boundary(msg, &ob)!=0) return -1;
+ if(get_boundary(msg, &ob)!=0) {
+ if(tmp.s) pkg_free(tmp.s);
+ return -1;
+ }
if(str_append(&ob, &bsuffix, &b)!=0) {
LM_ERR("Can't append suffix to boundary\n");
goto error;
More information about the sr-dev
mailing list