[sr-dev] git:5.1:8200a5b6: core: free resources in xavp_clone_level_nodata

Henning Westerholt hw at kamailio.org
Sat Mar 9 12:57:40 CET 2019


Module: kamailio
Branch: 5.1
Commit: 8200a5b68a5a2852bbd813fdec1bd82ef8a6ea01
URL: https://github.com/kamailio/kamailio/commit/8200a5b68a5a2852bbd813fdec1bd82ef8a6ea01

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-03-09T12:56:12+01:00

core: free resources in xavp_clone_level_nodata

(cherry picked from commit 0c93efec739551f3e74e119d4b789d0bb6e766d6)

---

Modified: src/core/xavp.c

---

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

---

diff --git a/src/core/xavp.c b/src/core/xavp.c
index df6ab03a6f..916b738ed9 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -660,14 +660,11 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
 			if(navp==NULL)
 			{
 				LM_ERR("cannot create cloned embedded xavp\n");
-				if(xnew->val.v.xavp == NULL)
-				{
-					shm_free(xnew);
-					return NULL;
-				} else {
-					xavp_destroy_list(&navp);
-					return NULL;
+				if(xnew->val.v.xavp != NULL) {
+					xavp_destroy_list(&xnew->val.v.xavp);
 				}
+				shm_free(xnew);
+				return NULL;
 			}
 			LM_DBG("cloned inner xavp [%.*s]\n", oavp->name.len, oavp->name.s);
 			if(xnew->val.v.xavp == NULL)




More information about the sr-dev mailing list