Merge pull request #715 from redis/test-leaks

Fixes leaks in unit tests
This commit is contained in:
Michael Grunder 2019-10-08 10:55:15 -07:00 committed by GitHub
commit 18eeeed076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
test.c
View File

@ -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 &&