Skip to content

Commit

Permalink
fix memory leaking caused by r.max and r.min (#87)
Browse files Browse the repository at this point in the history
* fix core on r.optimize #83

* add test for #83

* fixing #85 for missing bits, and add write to optimize

* add test

* fixing memory leak by r.max and r.min
  • Loading branch information
arthurkiller authored Jul 23, 2021
1 parent 3dbd209 commit 10e2827
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/redis-roaring.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ int RMinCommand(RedisModuleCtx* ctx, RedisModuleString** argv, int argc) {
return RedisModule_WrongArity(ctx);
}

RedisModule_AutoMemory(ctx);
RedisModuleKey* key = RedisModule_OpenKey(ctx, argv[1], REDISMODULE_READ);
int type = RedisModule_KeyType(key);
if (type != REDISMODULE_KEYTYPE_EMPTY && RedisModule_ModuleTypeGetType(key) != BitmapType) {
Expand Down Expand Up @@ -768,6 +769,7 @@ int RMaxCommand(RedisModuleCtx* ctx, RedisModuleString** argv, int argc) {
return RedisModule_WrongArity(ctx);
}

RedisModule_AutoMemory(ctx);
RedisModuleKey* key = RedisModule_OpenKey(ctx, argv[1], REDISMODULE_READ);
int type = RedisModule_KeyType(key);
if (type != REDISMODULE_KEYTYPE_EMPTY && RedisModule_ModuleTypeGetType(key) != BitmapType) {
Expand Down

0 comments on commit 10e2827

Please sign in to comment.