[sr-dev] git:master:a05f5824: carrierroute: proper str pointer when adding fields to rpc structure

Daniel-Constantin Mierla miconda at gmail.com
Fri Jan 6 08:43:05 CET 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-01-06T08:42:16+01:00

carrierroute: proper str pointer when adding fields to rpc structure

---

Modified: src/modules/carrierroute/cr_fifo.c

---

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

---

diff --git a/src/modules/carrierroute/cr_fifo.c b/src/modules/carrierroute/cr_fifo.c
index 6e0a7a2..8789c9b 100644
--- a/src/modules/carrierroute/cr_fifo.c
+++ b/src/modules/carrierroute/cr_fifo.c
@@ -1185,11 +1185,13 @@ void cr_rpc_dump_routes(rpc_t* rpc, void* ctx)
 				goto error;
 			}
 			tmp_str = (rd->carriers[i] ? rd->carriers[i]->name : &empty_str);
-			if(rpc->struct_add(dh, "Sd[", "carrier", &tmp_str,
+			if(rpc->struct_add(dh, "Sd[", "carrier", tmp_str,
 						"id", (rd->carriers[i] ? rd->carriers[i]->id : 0),
 						"domains",  &eh)<0)
 			{
-				LM_ERR("add carrier structure failure at count %d\n", i);
+				LM_ERR("add carrier structure failure at count %d"
+						" (carrier: %d/%.*s)\n",
+						i, tmp_str->len, tmp_str->len, tmp_str->s);
 				rpc->fault(ctx, 500, "Internal error - carrier structure");
 				goto error;
 			}
@@ -1202,7 +1204,7 @@ void cr_rpc_dump_routes(rpc_t* rpc, void* ctx)
 						goto error;
 					}
 					tmp_str = (rd->carriers[i]->domains[j] ? rd->carriers[i]->domains[j]->name : &empty_str);
-					if(rpc->struct_add(fh, "Sd[", "domain", &tmp_str,
+					if(rpc->struct_add(fh, "Sd[", "domain", tmp_str,
 							"id", rd->carriers[i]->domains[j]->id,
 							"data",  &gh)<0)
 					{




More information about the sr-dev mailing list