mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Fix memory leaks in newly added ZDIFF (#8056)
This commit is contained in:
parent
c1aaad06d8
commit
9812e88959
@ -2267,6 +2267,7 @@ static void zdiffAlgorithm1(zsetopsrc *src, long setnum, zset *dstzset, size_t *
|
|||||||
if (sdslen(tmp) > *maxelelen) *maxelelen = sdslen(tmp);
|
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);
|
dictAdd(dstzset->dict,tmp,&znode->score);
|
||||||
cardinality++;
|
cardinality++;
|
||||||
} else {
|
} else {
|
||||||
tmp = zuiNewSdsFromValue(&zval);
|
tmp = zuiSdsFromValue(&zval);
|
||||||
if (zsetRemoveFromSkiplist(dstzset, tmp)) {
|
if (zsetRemoveFromSkiplist(dstzset, tmp)) {
|
||||||
cardinality--;
|
cardinality--;
|
||||||
}
|
}
|
||||||
@ -2314,6 +2315,7 @@ static void zdiffAlgorithm2(zsetopsrc *src, long setnum, zset *dstzset, size_t *
|
|||||||
* of elements will have no effect. */
|
* of elements will have no effect. */
|
||||||
if (cardinality == 0) break;
|
if (cardinality == 0) break;
|
||||||
}
|
}
|
||||||
|
zuiClearIterator(&src[j]);
|
||||||
|
|
||||||
if (cardinality == 0) break;
|
if (cardinality == 0) break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user