Skip to content

Commit 765ffa1

Browse files
committed
sysusers: use trivial_hash_ops_free for storing user/group name
1 parent 5f43554 commit 765ffa1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/sysusers/sysusers.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static void context_done(Context *c) {
143143
hashmap_free(c->database_by_gid);
144144
hashmap_free(c->database_by_groupname);
145145

146-
set_free_free(c->names);
146+
set_free(c->names);
147147
uid_range_free(c->uid_range);
148148
}
149149

@@ -231,9 +231,8 @@ static int load_user_database(Context *c) {
231231
if (!n)
232232
return -ENOMEM;
233233

234-
/* Note that we use NULL hash_ops (i.e. trivial_hash_ops) here, so identical strings can
235-
* exist in the set. */
236-
r = set_ensure_consume(&c->names, /* hash_ops= */ NULL, n);
234+
/* Note that we use trivial_hash_ops_free here, so identical strings can exist in the set. */
235+
r = set_ensure_consume(&c->names, &trivial_hash_ops_free, n);
237236
if (r < 0)
238237
return r;
239238
assert(r > 0); /* The set uses pointer comparisons, so n must not be in the set. */
@@ -274,9 +273,8 @@ static int load_group_database(Context *c) {
274273
if (!n)
275274
return -ENOMEM;
276275

277-
/* Note that we use NULL hash_ops (i.e. trivial_hash_ops) here, so identical strings can
278-
* exist in the set. */
279-
r = set_ensure_consume(&c->names, /* hash_ops= */ NULL, n);
276+
/* Note that we use trivial_hash_ops_free here, so identical strings can exist in the set. */
277+
r = set_ensure_consume(&c->names, &trivial_hash_ops_free, n);
280278
if (r < 0)
281279
return r;
282280
assert(r > 0); /* The set uses pointer comparisons, so n must not be in the set. */

0 commit comments

Comments
 (0)