Browse code

core: free resources in xavp_clone_level_nodata

lazedo authored on 05/03/2019 10:33:08 • Henning Westerholt committed on 09/03/2019 11:52:43
Showing 1 changed files
... ...
@@ -714,14 +714,11 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
714 714
 			if(navp==NULL)
715 715
 			{
716 716
 				LM_ERR("cannot create cloned embedded xavp\n");
717
-				if(xnew->val.v.xavp == NULL)
718
-				{
719
-					shm_free(xnew);
720
-					return NULL;
721
-				} else {
722
-					xavp_destroy_list(&navp);
723
-					return NULL;
717
+				if(xnew->val.v.xavp != NULL) {
718
+					xavp_destroy_list(&xnew->val.v.xavp);
724 719
 				}
720
+				shm_free(xnew);
721
+				return NULL;
725 722
 			}
726 723
 			LM_DBG("cloned inner xavp [%.*s]\n", oavp->name.len, oavp->name.s);
727 724
 			if(xnew->val.v.xavp == NULL)