Use a safe iterator while saving the DB, since the getExpire() function will access the iterating dictionary.

This commit is contained in:
antirez 2011-06-17 15:40:55 +02:00
parent f2ac94876d
commit b04e800b98
2 changed files with 2 additions and 2 deletions

View File

@ -354,7 +354,7 @@ int rewriteAppendOnlyFile(char *filename) {
redisDb *db = server.db+j;
dict *d = db->dict;
if (dictSize(d) == 0) continue;
di = dictGetIterator(d);
di = dictGetSafeIterator(d);
if (!di) {
fclose(fp);
return REDIS_ERR;

View File

@ -416,7 +416,7 @@ int rdbSave(char *filename) {
redisDb *db = server.db+j;
dict *d = db->dict;
if (dictSize(d) == 0) continue;
di = dictGetIterator(d);
di = dictGetSafeIterator(d);
if (!di) {
fclose(fp);
return REDIS_ERR;