[sr-dev] git:5.1:0a885dab: jsonrpcs: Fix memleak with srjson_doc_t
Henning Westerholt
hw at kamailio.org
Tue Feb 5 21:29:06 CET 2019
Module: kamailio
Branch: 5.1
Commit: 0a885dab3dd4a54dd7a6948bf25629fd6681770a
URL: https://github.com/kamailio/kamailio/commit/0a885dab3dd4a54dd7a6948bf25629fd6681770a
Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-05T21:17:54+01:00
jsonrpcs: Fix memleak with srjson_doc_t
(cherry picked from commit 8e5742ff1657bdb2adce357fc6f1a2e04fd913c6)
---
Modified: src/modules/jsonrpcs/jsonrpcs_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/0a885dab3dd4a54dd7a6948bf25629fd6681770a.diff
Patch: https://github.com/kamailio/kamailio/commit/0a885dab3dd4a54dd7a6948bf25629fd6681770a.patch
---
diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c b/src/modules/jsonrpcs/jsonrpcs_mod.c
index 886872d379..ca614d55b6 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -1253,6 +1253,7 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, char* s2)
if(ctx->jreq->root == NULL)
{
LM_ERR("invalid json doc [[%s]]\n", ctx->jreq->buf.s);
+ srjson_DeleteDoc(ctx->jreq);
return NONSIP_MSG_ERROR;
}
ctx->transport = JSONRPC_TRANS_HTTP;
@@ -1298,6 +1299,7 @@ static int jsonrpc_dispatch(sip_msg_t* msg, char* s1, char* s2)
if (!ctx->reply_sent && !(ctx->flags&JSONRPC_DELAYED_REPLY_F)) {
ret = jsonrpc_send(ctx);
}
+ srjson_DeleteDoc(ctx->jreq);
jsonrpc_clean_context(ctx);
if (ret < 0) return -1;
return 1;
More information about the sr-dev
mailing list