From 23fbcbd1849b7274eb49cccfad8b8ffb9fa77b45 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 12 Sep 2012 02:32:03 +0000 Subject: [PATCH] Bugfix: Correct "id" in requests (the 0 was leaked and the 2 double-freed) --- blkmaker_jansson.c | 9 +++++---- testinput.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/blkmaker_jansson.c b/blkmaker_jansson.c index e8a87c2..02c4aef 100644 --- a/blkmaker_jansson.c +++ b/blkmaker_jansson.c @@ -34,17 +34,18 @@ json_t *blktmpl_request_jansson(gbt_capabilities_t caps) { if (json_array_append_new(jcaps, jstr)) goto err; } - if (!(jstr = json_integer(0))) - goto err; + jstr = NULL; if (json_object_set_new(req, "capabilities", jcaps)) goto err; jcaps = NULL; + if (!(jstr = json_integer(0))) + goto err; + if (json_object_set_new(reqf, "id", jstr)) + goto err; if (!(jstr = json_integer(BLKMAKER_MAX_BLOCK_VERSION))) goto err; if (json_object_set_new(req, "maxversion", jstr)) goto err; - if (json_object_set_new(reqf, "id", jstr)) - goto err; if (!(jstr = json_string("getblocktemplate"))) goto err; if (json_object_set_new(reqf, "method", jstr)) diff --git a/testinput.c b/testinput.c index 540c7a6..4b9c8f2 100644 --- a/testinput.c +++ b/testinput.c @@ -31,7 +31,7 @@ const char *blkmaker_test_input = "\"sizelimit\": 1000000," "\"bits\": \"ffff001d\"" "}," - "\"id\": 2," + "\"id\": 0," "\"error\": null" "}" ; \ No newline at end of file