Browse code

core: fix leak in case of error to get boundary inside check_boundaries()

- impacted setting multi-part body function

(cherry picked from commit 2b427a33937c6a86ab231de39d5a4574309dbfc6)

sergey-vb authored on 28/04/2016 20:32:14
Showing 1 changed files
... ...
@@ -1688,7 +1688,8 @@ int get_boundary(struct sip_msg* msg, str* boundary)
1688 1688
 		msg->content_type->body.len);
1689 1689
 	if (params.s == NULL)
1690 1690
 	{
1691
-		LM_ERR("Content-Type hdr has no params\n");
1691
+		LM_INFO("Content-Type hdr has no params <%.*s>\n",
1692
+				msg->content_type->body.len, msg->content_type->body.s);
1692 1693
 		return -1;
1693 1694
 	}
1694 1695
 	params.len = msg->content_type->body.len -
... ...
@@ -1749,7 +1750,10 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info)
1749 1749
 		}
1750 1750
 		tmp.s = buf.s;
1751 1751
 		t = tmp.len = buf.len;
1752
-		if(get_boundary(msg, &ob)!=0) return -1;
1752
+		if(get_boundary(msg, &ob)!=0) {
1753
+			if(tmp.s) pkg_free(tmp.s);
1754
+			return -1;
1755
+		}
1753 1756
 		if(str_append(&ob, &bsuffix, &b)!=0) {
1754 1757
 			LM_ERR("Can't append suffix to boundary\n");
1755 1758
 			goto error;