Răsfoiți Sursa

ims_isc: free allocated route in case of error

Daniel-Constantin Mierla 4 luni în urmă
părinte
comite
76a72a0092
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  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 hdr_field *first;
 	struct lump *anchor;
 	struct lump *anchor;
-	str route;
+	str route = STR_NULL;
 
 
 	parse_headers(msg, HDR_EOH_F, 0);
 	parse_headers(msg, HDR_EOH_F, 0);
 	first = msg->headers;
 	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);
 	anchor = anchor_lump(msg, first->name.s - msg->buf, 0, HDR_ROUTE_T);
 	if(anchor == NULL) {
 	if(anchor == NULL) {
 		LM_ERR("isc_mark_write_route: anchor_lump failed\n");
 		LM_ERR("isc_mark_write_route: anchor_lump failed\n");
+		pkg_free(route.s);
 		return 0;
 		return 0;
 	}
 	}