mirror of
https://github.com/fluencelabs/redis
synced 2025-04-26 02:52:15 +00:00
fix leak in module api rdb test
recently added more reads into that function, if a later read fails, i must either free what's already allocated, or return the pointer so that the free callback will release it.
This commit is contained in:
parent
a15a5d7097
commit
02f21113ab
@ -18,8 +18,11 @@ void *testrdb_type_load(RedisModuleIO *rdb, int encver) {
|
|||||||
RedisModuleString *str = RedisModule_LoadString(rdb);
|
RedisModuleString *str = RedisModule_LoadString(rdb);
|
||||||
float f = RedisModule_LoadFloat(rdb);
|
float f = RedisModule_LoadFloat(rdb);
|
||||||
long double ld = RedisModule_LoadLongDouble(rdb);
|
long double ld = RedisModule_LoadLongDouble(rdb);
|
||||||
if (RedisModule_IsIOError(rdb))
|
if (RedisModule_IsIOError(rdb)) {
|
||||||
|
RedisModuleCtx *ctx = RedisModule_GetContextFromIO(rdb);
|
||||||
|
RedisModule_FreeString(ctx, str);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
/* Using the values only after checking for io errors. */
|
/* Using the values only after checking for io errors. */
|
||||||
assert(count==1);
|
assert(count==1);
|
||||||
assert(encver==1);
|
assert(encver==1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user