[sr-dev] git:master:d6504e28: siputils: free params for contact param decode and remove

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 8 11:55:12 CET 2021


Module: kamailio
Branch: master
Commit: d6504e28f7fef8d48480861ea12e9bd457288661
URL: https://github.com/kamailio/kamailio/commit/d6504e28f7fef8d48480861ea12e9bd457288661

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-02-08T11:54:32+01:00

siputils: free params for contact param decode and remove

---

Modified: src/modules/siputils/contact_ops.c

---

Diff:  https://github.com/kamailio/kamailio/commit/d6504e28f7fef8d48480861ea12e9bd457288661.diff
Patch: https://github.com/kamailio/kamailio/commit/d6504e28f7fef8d48480861ea12e9bd457288661.patch

---

diff --git a/src/modules/siputils/contact_ops.c b/src/modules/siputils/contact_ops.c
index a299db32e5..f21d7705b3 100644
--- a/src/modules/siputils/contact_ops.c
+++ b/src/modules/siputils/contact_ops.c
@@ -773,6 +773,7 @@ int ki_contact_param_decode(sip_msg_t *msg, str *nparam)
 		}
 		if(pit==NULL || pit->body.len<=0) {
 			free_params(params);
+			params = NULL;
 			continue;
 		}
 
@@ -816,6 +817,8 @@ int ki_contact_param_decode(sip_msg_t *msg, str *nparam)
 			pkg_free(nval.s);
 			return -2;
 		}
+		free_params(params);
+		params = NULL;
 	}
 
 	return 1;
@@ -974,6 +977,7 @@ int ki_contact_param_rm(sip_msg_t *msg, str *nparam)
 		}
 		if(pit==NULL) {
 			free_params(params);
+			params = NULL;
 			continue;
 		}
 		rms.s = pit->name.s;
@@ -984,6 +988,7 @@ int ki_contact_param_rm(sip_msg_t *msg, str *nparam)
 			LM_ERR("failed to find start of the parameter delimiter [%.*s]\n",
 					c->uri.len, c->uri.s);
 			free_params(params);
+			params = NULL;
 			continue;
 		}
 		if(pit->body.len>0) {
@@ -1004,6 +1009,7 @@ int ki_contact_param_rm(sip_msg_t *msg, str *nparam)
 			continue;
 		}
 		free_params(params);
+		params = NULL;
 	}
 
 	return 1;




More information about the sr-dev mailing list