Fix memory leaks in newly added ZDIFF (#8056)

This commit is contained in:
Oran Agra 2020-11-16 16:37:15 +02:00 committed by GitHub
parent c1aaad06d8
commit 9812e88959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2267,6 +2267,7 @@ static void zdiffAlgorithm1(zsetopsrc *src, long setnum, zset *dstzset, size_t *
if (sdslen(tmp) > *maxelelen) *maxelelen = sdslen(tmp);
}
}
zuiClearIterator(&src[0]);
}
@ -2304,7 +2305,7 @@ static void zdiffAlgorithm2(zsetopsrc *src, long setnum, zset *dstzset, size_t *
dictAdd(dstzset->dict,tmp,&znode->score);
cardinality++;
} else {
tmp = zuiNewSdsFromValue(&zval);
tmp = zuiSdsFromValue(&zval);
if (zsetRemoveFromSkiplist(dstzset, tmp)) {
cardinality--;
}
@ -2314,6 +2315,7 @@ static void zdiffAlgorithm2(zsetopsrc *src, long setnum, zset *dstzset, size_t *
* of elements will have no effect. */
if (cardinality == 0) break;
}
zuiClearIterator(&src[j]);
if (cardinality == 0) break;
}