소스 검색

jsonrpcs: Fix memleak with srjson_doc_t

(cherry picked from commit 8e5742ff1657bdb2adce357fc6f1a2e04fd913c6)
(cherry picked from commit 0a885dab3dd4a54dd7a6948bf25629fd6681770a)
Alex Hermann 7 년 전
부모
커밋
d2bc6dcff7
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      src/modules/jsonrpcs/jsonrpcs_mod.c

+ 2 - 0
src/modules/jsonrpcs/jsonrpcs_mod.c

@@ -1216,6 +1216,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;
@@ -1261,6 +1262,7 @@ send_reply:
 	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;