]> git.saurik.com Git - redis.git/blobdiff - src/aof.c
Lua call of Redis command work in progress: sorry I have to go to the cinema to watch...
[redis.git] / src / aof.c
index cd7c48d3f0dfe76d24cd5ce0f10346f56c1f3ec5..ef72a2b169a007387179e5d24d4830fcbb50e047 100644 (file)
--- a/src/aof.c
+++ b/src/aof.c
@@ -284,9 +284,11 @@ int loadAppendOnlyFile(char *filename) {
         /* The fake client should not have a reply */
         redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0);
 
-        /* Clean up, ready for the next command */
-        for (j = 0; j < argc; j++) decrRefCount(argv[j]);
-        zfree(argv);
+        /* Clean up. Command code may have changed argv/argc so we use the
+         * argv/argc of the client instead of the local variables. */
+        for (j = 0; j < fakeClient->argc; j++)
+            decrRefCount(fakeClient->argv[j]);
+        zfree(fakeClient->argv);
     }
 
     /* This point can only be reached when EOF is reached without errors.
@@ -346,7 +348,7 @@ int rewriteAppendOnlyFile(char *filename) {
 
         /* Iterate this DB writing every entry */
         while((de = dictNext(di)) != NULL) {
-            sds keystr = dictGetEntryKey(de);
+            sds keystr;
             robj key, *o;
             time_t expiretime;
 
@@ -460,7 +462,7 @@ int rewriteAppendOnlyFile(char *filename) {
                         }
                         zzlNext(zl,&eptr,&sptr);
                     }
-                } else if (o->encoding == REDIS_ENCODING_RAW) {
+                } else if (o->encoding == REDIS_ENCODING_SKIPLIST) {
                     zset *zs = o->ptr;
                     dictIterator *di = dictGetIterator(zs->dict);
                     dictEntry *de;