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
redis
Commits
5d0890c0
Commit
5d0890c0
authored
Feb 06, 2020
by
Guy Benoish
Committed by
antirez
Feb 27, 2020
Browse files
Fix memory leak in test_ld_conv
parent
d1f22eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/modules/misc.c
View file @
5d0890c0
...
@@ -74,6 +74,7 @@ int test_ld_conv(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
...
@@ -74,6 +74,7 @@ int test_ld_conv(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
RedisModule_ReplyWithError
(
ctx
,
err
);
RedisModule_ReplyWithError
(
ctx
,
err
);
goto
final
;
goto
final
;
}
}
/* Make sure we can't convert a string that has \0 in it */
/* Make sure we can't convert a string that has \0 in it */
char
buf
[
4
]
=
"123"
;
char
buf
[
4
]
=
"123"
;
buf
[
1
]
=
'\0'
;
buf
[
1
]
=
'\0'
;
...
@@ -81,8 +82,11 @@ int test_ld_conv(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
...
@@ -81,8 +82,11 @@ int test_ld_conv(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
long
double
ld3
;
long
double
ld3
;
if
(
RedisModule_StringToLongDouble
(
s3
,
&
ld3
)
==
REDISMODULE_OK
)
{
if
(
RedisModule_StringToLongDouble
(
s3
,
&
ld3
)
==
REDISMODULE_OK
)
{
RedisModule_ReplyWithError
(
ctx
,
"Invalid string successfully converted to long double"
);
RedisModule_ReplyWithError
(
ctx
,
"Invalid string successfully converted to long double"
);
RedisModule_FreeString
(
ctx
,
s3
);
goto
final
;
goto
final
;
}
}
RedisModule_FreeString
(
ctx
,
s3
);
RedisModule_ReplyWithLongDouble
(
ctx
,
ld2
);
RedisModule_ReplyWithLongDouble
(
ctx
,
ld2
);
final:
final:
RedisModule_FreeString
(
ctx
,
s1
);
RedisModule_FreeString
(
ctx
,
s1
);
...
...
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