Module: kamailio
Branch: master
Commit: 8e5742ff1657bdb2adce357fc6f1a2e04fd913c6
URL:
https://github.com/kamailio/kamailio/commit/8e5742ff1657bdb2adce357fc6f1a2e…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Henning Westerholt <henningw(a)users.noreply.github.com>
Date: 2019-02-05T21:11:03+01:00
jsonrpcs: Fix memleak with srjson_doc_t
---
Modified: src/modules/jsonrpcs/jsonrpcs_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8e5742ff1657bdb2adce357fc6f1a2e…
Patch:
https://github.com/kamailio/kamailio/commit/8e5742ff1657bdb2adce357fc6f1a2e…
---
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;