mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Use a safe iterator while saving the DB, since the getExpire() function will access the iterating dictionary.
This commit is contained in:
parent
55937b7972
commit
591f29e0f5
@ -342,7 +342,7 @@ int rewriteAppendOnlyFile(char *filename) {
|
|||||||
redisDb *db = server.db+j;
|
redisDb *db = server.db+j;
|
||||||
dict *d = db->dict;
|
dict *d = db->dict;
|
||||||
if (dictSize(d) == 0) continue;
|
if (dictSize(d) == 0) continue;
|
||||||
di = dictGetIterator(d);
|
di = dictGetSafeIterator(d);
|
||||||
if (!di) {
|
if (!di) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
|
@ -430,7 +430,7 @@ int rdbSave(char *filename) {
|
|||||||
redisDb *db = server.db+j;
|
redisDb *db = server.db+j;
|
||||||
dict *d = db->dict;
|
dict *d = db->dict;
|
||||||
if (dictSize(d) == 0) continue;
|
if (dictSize(d) == 0) continue;
|
||||||
di = dictGetIterator(d);
|
di = dictGetSafeIterator(d);
|
||||||
if (!di) {
|
if (!di) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
|
Loading…
Reference in New Issue
Block a user