Commit 591f29e0 authored by antirez's avatar antirez
Browse files

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

Use a safe iterator while saving the DB, since the getExpire() function will access the iterating dictionary.
parent 55937b79
...@@ -342,7 +342,7 @@ int rewriteAppendOnlyFile(char *filename) { ...@@ -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) { ...@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment