Browse Source

jsonrpc: reset the local reply structure before executing new commands

Daniel-Constantin Mierla 11 years ago
parent
commit
43de8b203c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      modules/jsonrpc-s/jsonrpc-s_mod.c

+ 2 - 1
modules/jsonrpc-s/jsonrpc-s_mod.c

@@ -1003,7 +1003,6 @@ static int jsonrpc_exec(sip_msg_t* msg, char* cmd, char* s2)
 		LM_ERR("Failed to init the json document\n");
 		return -1;
 	}
-
 	ctx->jreq->buf = scmd;
 	ctx->jreq->root = srjson_Parse(ctx->jreq, ctx->jreq->buf.s);
 	if(ctx->jreq->root == NULL)
@@ -1014,6 +1013,8 @@ static int jsonrpc_exec(sip_msg_t* msg, char* cmd, char* s2)
 	}
 	ret = -1;
 	if (jsonrpc_init_reply(ctx) < 0) goto send_reply;
+	jsonrpc_reset_plain_reply(ctx->jrpl->free_fn);
+
 
 	/* sanity checks on jsonrpc request */
 	nj = srjson_GetObjectItem(ctx->jreq, ctx->jreq->root, "jsonrpc");