summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-06-17 15:40:55 +0200
committerantirez <antirez@gmail.com>2011-06-17 15:41:10 +0200
commit25e805b417303531f78e1320426f6f9f2ad4d300 (patch)
tree45f97ebd470c19f10494a22df40b22cbfdfa7b56
parent4ec8b732b7b89bffa5586074a69737079bb0ea7f (diff)
downloadredis-25e805b417303531f78e1320426f6f9f2ad4d300.tar.gz
Use a safe iterator while saving the DB, since the getExpire() function will access the iterating dictionary.
-rw-r--r--src/aof.c2
-rw-r--r--src/rdb.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/aof.c b/src/aof.c
index 24ddec352..e30c77f29 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -348,7 +348,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;
diff --git a/src/rdb.c b/src/rdb.c
index 5e69a3244..3e29a21e9 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -427,7 +427,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;