[sr-dev] git:5.5:b8329204: Erlang: Revert breaking change

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 2 12:47:11 CET 2022


Module: kamailio
Branch: 5.5
Commit: b83292042aae87c445e05c3f82231ca6d335cc96
URL: https://github.com/kamailio/kamailio/commit/b83292042aae87c445e05c3f82231ca6d335cc96

Author: James Van Vleet <james at vanvleet.net>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-03-02T10:14:11+01:00

Erlang: Revert breaking change

Revert https://github.com/kamailio/kamailio/commit/6542a367638ec5f8a2b62994f8c309e7a2533962
xavp_add_xavp_value returns the root and not the xavp it added and that was the reason for the code the commit removed.  Changed a variable name to help make that more clear.

Also related to https://github.com/kamailio/kamailio/issues/2069.

(cherry picked from commit 1ed58f0de4f7a3ab3a81dd84c1c3b94fa1df2c4b)

---

Modified: src/modules/erlang/pv_xbuff.c

---

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

---

diff --git a/src/modules/erlang/pv_xbuff.c b/src/modules/erlang/pv_xbuff.c
index 894c36784c..b19a22ac8e 100644
--- a/src/modules/erlang/pv_xbuff.c
+++ b/src/modules/erlang/pv_xbuff.c
@@ -86,11 +86,15 @@ sr_xavp_t *xbuff_new(str *name)
 
 	if(!xbuffs_root)
 	{
-		xbuff = xavp_add_xavp_value(&xbuff_list,name,&xbuff_val,xavp_get_crt_list());
-	} else {
-		xbuff = xavp_get_child(&xbuff_list, name);
+		xbuffs_root = xavp_add_xavp_value(&xbuff_list,name,&xbuff_val,xavp_get_crt_list());
+		if (!xbuffs_root){
+				LM_ERR("cannot create xbuffs_root \n");
+				return NULL;
+			}
 	}
 
+	xbuff = xavp_get_child(&xbuff_list, name);
+
 	if (!xbuff) {
 
 		xbuff_val.type = SR_XTYPE_NULL;




More information about the sr-dev mailing list