From 25e805b417303531f78e1320426f6f9f2ad4d300 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 17 Jun 2011 15:40:55 +0200 Subject: [PATCH] Use a safe iterator while saving the DB, since the getExpire() function will access the iterating dictionary. --- src/aof.c | 2 +- src/rdb.c | 2 +- 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;