Fix rdb.c dictionary iterator release in 2 more places.

This commit is contained in:
antirez 2018-05-09 12:06:37 +02:00
parent cd87b3c71f
commit b85aae78df

View File

@ -772,7 +772,10 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
dictIterator *di = dictGetIterator(set); dictIterator *di = dictGetIterator(set);
dictEntry *de; dictEntry *de;
if ((n = rdbSaveLen(rdb,dictSize(set))) == -1) return -1; if ((n = rdbSaveLen(rdb,dictSize(set))) == -1) {
dictReleaseIterator(di);
return -1;
}
nwritten += n; nwritten += n;
while((de = dictNext(di)) != NULL) { while((de = dictNext(di)) != NULL) {
@ -842,7 +845,10 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
dictIterator *di = dictGetIterator(o->ptr); dictIterator *di = dictGetIterator(o->ptr);
dictEntry *de; dictEntry *de;
if ((n = rdbSaveLen(rdb,dictSize((dict*)o->ptr))) == -1) return -1; if ((n = rdbSaveLen(rdb,dictSize((dict*)o->ptr))) == -1) {
dictReleaseIterator(di);
return -1;
}
nwritten += n; nwritten += n;
while((de = dictNext(di)) != NULL) { while((de = dictNext(di)) != NULL) {