summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-06-09 09:23:54 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-06-09 09:25:09 +0200
commit5f5b3d9787198bca6724b576ed778acd89c072db (patch)
tree8b2b3f43ab77706dedef48146f89ce3e1086b543 /test.c
parent159a83ab8a6699c9a4c073a943a774baf1116f97 (diff)
Fix for issue #45
Diffstat (limited to 'test.c')
-rw-r--r--test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test.c b/test.c
index 6a56f32..9022f73 100644
--- a/test.c
+++ b/test.c
@@ -247,6 +247,18 @@ static void test_reply_reader(void) {
assert(ret == REDIS_ERR);
ret = redisReaderGetReply(reader,&reply);
test_cond(ret == REDIS_ERR && reply == NULL);
+ redisReaderFree(reader);
+
+ /* Regression test for issue #45 on GitHub. */
+ test("Don't do empty allocation for empty multi bulk: ");
+ reader = redisReaderCreate();
+ redisReaderFeed(reader,(char*)"*0\r\n",4);
+ ret = redisReaderGetReply(reader,&reply);
+ test_cond(ret == REDIS_OK &&
+ ((redisReply*)reply)->type == REDIS_REPLY_ARRAY &&
+ ((redisReply*)reply)->elements == 0);
+ freeReplyObject(reply);
+ redisReaderFree(reader);
}
static void *test_create_string(const redisReadTask *task, char *str, size_t len) {