mirror of https://mirror.osredm.com/root/redis.git
Fix memory leak in RM_StreamIteratorStop and moduleFreeKeyIterator (#10353)
* Fix memory leak in RM_StreamIteratorStop * Fix memory leak in moduleFreeKeyIterator
This commit is contained in:
parent
9478d5a134
commit
dff153ff24
|
@ -596,7 +596,10 @@ static void moduleFreeKeyIterator(RedisModuleKey *key) {
|
||||||
serverAssert(key->iter != NULL);
|
serverAssert(key->iter != NULL);
|
||||||
switch (key->value->type) {
|
switch (key->value->type) {
|
||||||
case OBJ_LIST: listTypeReleaseIterator(key->iter); break;
|
case OBJ_LIST: listTypeReleaseIterator(key->iter); break;
|
||||||
case OBJ_STREAM: zfree(key->iter); break;
|
case OBJ_STREAM:
|
||||||
|
streamIteratorStop(key->iter);
|
||||||
|
zfree(key->iter);
|
||||||
|
break;
|
||||||
default: serverAssert(0); /* No key->iter for other types. */
|
default: serverAssert(0); /* No key->iter for other types. */
|
||||||
}
|
}
|
||||||
key->iter = NULL;
|
key->iter = NULL;
|
||||||
|
@ -5103,6 +5106,7 @@ int RM_StreamIteratorStop(RedisModuleKey *key) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return REDISMODULE_ERR;
|
return REDISMODULE_ERR;
|
||||||
}
|
}
|
||||||
|
streamIteratorStop(key->iter);
|
||||||
zfree(key->iter);
|
zfree(key->iter);
|
||||||
key->iter = NULL;
|
key->iter = NULL;
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
|
|
Loading…
Reference in New Issue