Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
5aa7b105
Commit
5aa7b105
authored
Sep 25, 2019
by
michael-grunder
Browse files
Fixes leaks in unit tests
redisFormatSdsCommandArgv takes an sds* and calls sdsempty() for us. Addresses #714
parent
01535274
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.c
View file @
5aa7b105
...
@@ -269,14 +269,14 @@ static void test_format_commands(void) {
...
@@ -269,14 +269,14 @@ static void test_format_commands(void) {
sds sds_cmd;
sds sds_cmd;
sds_cmd
=
sdsempty
()
;
sds_cmd =
NULL
;
test("Format command into sds by passing argc/argv without lengths: ");
test("Format command into sds by passing argc/argv without lengths: ");
len = redisFormatSdsCommandArgv(&sds_cmd,argc,argv,NULL);
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 &&
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));
len == 4+4+(3+2)+4+(3+2)+4+(3+2));
sdsfree(sds_cmd);
sdsfree(sds_cmd);
sds_cmd
=
sdsempty
()
;
sds_cmd =
NULL
;
test("Format command into sds by passing argc/argv with lengths: ");
test("Format command into sds by passing argc/argv with lengths: ");
len = redisFormatSdsCommandArgv(&sds_cmd,argc,argv,lens);
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 &&
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 &&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment