Module: kamailio
Branch: 5.2
Commit: 534a5233a025af26b1b4ddcb504d21902fdc5094
URL:
https://github.com/kamailio/kamailio/commit/534a5233a025af26b1b4ddcb504d219…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-05T21:17:49+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/534a5233a025af26b1b4ddcb504d219…
Patch:
https://github.com/kamailio/kamailio/commit/534a5233a025af26b1b4ddcb504d219…
---
diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c b/src/modules/jsonrpcs/jsonrpcs_mod.c
index 3169a104cc..8049779e55 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -1251,6 +1251,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;
@@ -1296,6 +1297,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;