[sr-dev] git:master:894e64ae: janssonrcp-c: Fix segfault in mod_destroy

Alex Hermann alex at hexla.nl
Sat Sep 23 07:58:48 CEST 2017


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

Author: Alex Hermann <alex at hexla.nl>
Committer: Alex Hermann <alex at hexla.nl>
Date: 2017-09-22T11:56:54+02:00

janssonrcp-c: Fix segfault in mod_destroy

Check variable before dereferencing it.

---

Modified: src/modules/janssonrpcc/janssonrpcc_mod.c

---

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

---

diff --git a/src/modules/janssonrpcc/janssonrpcc_mod.c b/src/modules/janssonrpcc/janssonrpcc_mod.c
index a6e9c010d3..5cdd5f8a5b 100644
--- a/src/modules/janssonrpcc/janssonrpcc_mod.c
+++ b/src/modules/janssonrpcc/janssonrpcc_mod.c
@@ -205,8 +205,10 @@ static int child_init(int rank)
 
 void mod_destroy(void)
 {
-	lock_get(jsonrpc_server_group_lock); /* blocking */
-	if(jsonrpc_server_group_lock) lock_dealloc(jsonrpc_server_group_lock);
+	if(jsonrpc_server_group_lock) {
+		lock_get(jsonrpc_server_group_lock); /* blocking */
+		lock_dealloc(jsonrpc_server_group_lock);
+	}
 
 	free_server_group(global_server_group);
 	CHECK_AND_FREE(global_server_group);




More information about the sr-dev mailing list