[sr-dev] git:5.2:cfd4947e: core: free resources in xavp_clone_level_nodata

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


Module: kamailio
Branch: 5.2
Commit: cfd4947edd6363b31c31706c7c352c5789642ddc
URL: https://github.com/kamailio/kamailio/commit/cfd4947edd6363b31c31706c7c352c5789642ddc

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-03-09T12:56:06+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/cfd4947edd6363b31c31706c7c352c5789642ddc.diff
Patch: https://github.com/kamailio/kamailio/commit/cfd4947edd6363b31c31706c7c352c5789642ddc.patch

---

diff --git a/src/core/xavp.c b/src/core/xavp.c
index 66797f910b..c758a98099 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -712,14 +712,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