浏览代码

ims_isc: free allocated route in case of error

Daniel-Constantin Mierla 4 月之前
父节点
当前提交
76a72a0092
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/modules/ims_isc/mark.c

+ 2 - 1
src/modules/ims_isc/mark.c

@@ -348,7 +348,7 @@ int isc_mark_write_route(struct sip_msg *msg, str *as, str *iscmark)
 {
 	struct hdr_field *first;
 	struct lump *anchor;
-	str route;
+	str route = STR_NULL;
 
 	parse_headers(msg, HDR_EOH_F, 0);
 	first = msg->headers;
@@ -367,6 +367,7 @@ int isc_mark_write_route(struct sip_msg *msg, str *as, str *iscmark)
 	anchor = anchor_lump(msg, first->name.s - msg->buf, 0, HDR_ROUTE_T);
 	if(anchor == NULL) {
 		LM_ERR("isc_mark_write_route: anchor_lump failed\n");
+		pkg_free(route.s);
 		return 0;
 	}