[sr-dev] git:master:c73a7eab: janssonrpc-c: fix double free introduced by

Emmanuel Schmidbauer emmanuel at getweave.com
Wed Nov 2 18:19:12 CET 2016


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

Author: Emmanuel Schmidbauer <emmanuel at getweave.com>
Committer: Emmanuel Schmidbauer <emmanuel at getweave.com>
Date: 2016-11-02T13:18:15-04:00

janssonrpc-c: fix double free introduced by
cf8d6066afc102d5904dddec0275079885f0ead1

---

Modified: modules/janssonrpc-c/janssonrpc_io.c

---

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

---

diff --git a/modules/janssonrpc-c/janssonrpc_io.c b/modules/janssonrpc-c/janssonrpc_io.c
index a25e40d..7cdb229 100644
--- a/modules/janssonrpc-c/janssonrpc_io.c
+++ b/modules/janssonrpc-c/janssonrpc_io.c
@@ -430,6 +430,7 @@ int jsonrpc_send(str conn, jsonrpc_request_t* req, bool notify_only)
 
 	if (sent) {
 		if (notify_only == true) { // free the request if using janssonrpc_notification function
+			free_req_cmd(req->cmd);
 			free_request(req);
 		} else {
 			const struct timeval tv = ms_to_tv(req->timeout);
@@ -534,8 +535,6 @@ void cmd_pipe_cb(int fd, short event, void *arg)
 		WARN("%s could not be sent to connection group: %.*s\n",
 				type, STR(req_cmd->conn));
 		fail_request(JRPC_ERR_SEND, req, "Failed to send request");
-	} else if (req_cmd->notify_only == true) { // free notification requests if they are sent
-		free_req_cmd(req_cmd);
 	}
 
 end:




More information about the sr-dev mailing list