1
0
mirror of https://github.com/jqlang/jq.git synced 2025-04-18 17:24:01 +03:00

jv_unique: don't leak non-unique elements that are not returned (#3304)

This commit is contained in:
Emanuele Torre 2025-03-28 23:16:46 +01:00 committed by GitHub
parent 947fcbbb1f
commit aea8efaf0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -749,6 +749,7 @@ jv jv_unique(jv objects, jv keys) {
for (int i = 0; i < n; i++) {
if (jv_equal(jv_copy(curr_key), jv_copy(entries[i].key))) {
jv_free(entries[i].key);
jv_free(entries[i].object);
} else {
jv_free(curr_key);
curr_key = entries[i].key;