From 5aa7b1056b6b52e69d5e37baee97fddeebf184d3 Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Wed, 25 Sep 2019 11:02:44 -0700 Subject: [PATCH] Fixes leaks in unit tests redisFormatSdsCommandArgv takes an sds* and calls sdsempty() for us. Addresses #714 --- test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.c b/test.c index 8668e18..de06973 100644 --- a/test.c +++ b/test.c @@ -269,14 +269,14 @@ static void test_format_commands(void) { sds sds_cmd; - sds_cmd = sdsempty(); + sds_cmd = NULL; test("Format command into sds by passing argc/argv without lengths: "); len = redisFormatSdsCommandArgv(&sds_cmd,argc,argv,NULL); test_cond(strncmp(sds_cmd,"*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n",len) == 0 && len == 4+4+(3+2)+4+(3+2)+4+(3+2)); sdsfree(sds_cmd); - sds_cmd = sdsempty(); + sds_cmd = NULL; test("Format command into sds by passing argc/argv with lengths: "); len = redisFormatSdsCommandArgv(&sds_cmd,argc,argv,lens); test_cond(strncmp(sds_cmd,"*3\r\n$3\r\nSET\r\n$7\r\nfoo\0xxx\r\n$3\r\nbar\r\n",len) == 0 &&