From: Lennart Poettering Date: Wed, 19 Nov 2014 15:43:03 +0000 (+0100) Subject: set: make set_consume() actually free the allocated string if the string already... X-Git-Tag: v218~418 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=575ccc1b6900f1f8e5c32da71f42f4d855659622 set: make set_consume() actually free the allocated string if the string already is in the set --- diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c index 2bc3b3873..5b329e085 100644 --- a/src/shared/hashmap.c +++ b/src/shared/hashmap.c @@ -1810,7 +1810,7 @@ int set_consume(Set *s, void *value) { int r; r = set_put(s, value); - if (r < 0) + if (r <= 0) free(value); return r;