mirror of https://mirror.osredm.com/root/redis.git
Simplify rax free for RM_FreeServerInfo (#8866)
This commit is contained in:
parent
a8b6596d23
commit
074e28a46e
11
src/module.c
11
src/module.c
|
@ -7101,16 +7101,7 @@ RedisModuleServerInfoData *RM_GetServerInfo(RedisModuleCtx *ctx, const char *sec
|
||||||
* context instead of passing NULL. */
|
* context instead of passing NULL. */
|
||||||
void RM_FreeServerInfo(RedisModuleCtx *ctx, RedisModuleServerInfoData *data) {
|
void RM_FreeServerInfo(RedisModuleCtx *ctx, RedisModuleServerInfoData *data) {
|
||||||
if (ctx != NULL) autoMemoryFreed(ctx,REDISMODULE_AM_INFO,data);
|
if (ctx != NULL) autoMemoryFreed(ctx,REDISMODULE_AM_INFO,data);
|
||||||
raxIterator ri;
|
raxFreeWithCallback(data->rax, (void(*)(void*))sdsfree);
|
||||||
raxStart(&ri,data->rax);
|
|
||||||
while(1) {
|
|
||||||
raxSeek(&ri,"^",NULL,0);
|
|
||||||
if (!raxNext(&ri)) break;
|
|
||||||
raxRemove(data->rax,(unsigned char*)ri.key,ri.key_len,NULL);
|
|
||||||
sdsfree(ri.data);
|
|
||||||
}
|
|
||||||
raxStop(&ri);
|
|
||||||
raxFree(data->rax);
|
|
||||||
zfree(data);
|
zfree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue