summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-02-20 13:08:31 +0100
committerGitHub <noreply@github.com>2020-02-20 13:08:31 +0100
commitc552fad6d45f89c768ffa8fedc27695476118bce (patch)
tree419976a91356fc69bb072f9689ee0cb0c18f7dc4
parent155526a44e69ea484661db2c13ed1624d42487d6 (diff)
parent5c73a6e2067f2bad1e622c372793a6d40ab1e2a0 (diff)
downloadredis-c552fad6d45f89c768ffa8fedc27695476118bce.tar.gz
Merge pull request #6864 from guybe7/fix_memleak_in_test_ld_conv
Fix memory leak in test_ld_conv
-rw-r--r--tests/modules/misc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/modules/misc.c b/tests/modules/misc.c
index 41bec06ed..1048d5065 100644
--- a/tests/modules/misc.c
+++ b/tests/modules/misc.c
@@ -74,6 +74,7 @@ int test_ld_conv(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
RedisModule_ReplyWithError(ctx, err);
goto final;
}
+
/* Make sure we can't convert a string that has \0 in it */
char buf[4] = "123";
buf[1] = '\0';
@@ -81,8 +82,11 @@ int test_ld_conv(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
long double ld3;
if (RedisModule_StringToLongDouble(s3, &ld3) == REDISMODULE_OK) {
RedisModule_ReplyWithError(ctx, "Invalid string successfully converted to long double");
+ RedisModule_FreeString(ctx, s3);
goto final;
}
+ RedisModule_FreeString(ctx, s3);
+
RedisModule_ReplyWithLongDouble(ctx, ld2);
final:
RedisModule_FreeString(ctx, s1);