[sr-dev] git:master:42d74f35: uid_avp_db: better error handling

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 20 09:32:13 CEST 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-20T09:31:49+02:00

uid_avp_db: better error handling

---

Modified: src/modules/uid_avp_db/extra_attrs.c

---

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

---

diff --git a/src/modules/uid_avp_db/extra_attrs.c b/src/modules/uid_avp_db/extra_attrs.c
index 888f84d675..6a88655c70 100644
--- a/src/modules/uid_avp_db/extra_attrs.c
+++ b/src/modules/uid_avp_db/extra_attrs.c
@@ -175,7 +175,8 @@ int declare_attr_group(modparam_t type, char* _param)
 	} while (p);
 	
 	if ((!rt->id) || (!rt->flag_name)) {
-		ERR("at least attribute group ID and flags must ve given\n");
+		ERR("at least attribute group ID and flags must be given\n");
+		pkg_free(rt);
 		return -1;
 	}
 	/* insert new element into registered tables */
@@ -449,6 +450,12 @@ int init_extra_avp_locks()
 	int i;
 	registered_table_t *t = tables;
 
+	if(register_script_cb(avpdb_post_script_cb,
+			REQUEST_CB | ONREPLY_CB | POST_SCRIPT_CB, 0)<0) {
+		LM_ERR("failed to register script callbacks\n");
+		return -1;
+	}
+
 	/* zero all 'lock counters' */
 	memset(lock_counters, 0, sizeof(lock_counters));
 
@@ -468,8 +475,6 @@ int init_extra_avp_locks()
 		t = t->next;
 	}
 
-	register_script_cb(avpdb_post_script_cb, REQUEST_CB | ONREPLY_CB | POST_SCRIPT_CB, 0);
-
 	return 0;
 }
 




More information about the sr-dev mailing list