From ef42202ac8ed27e7ff1fc90ef8bc2590046dff25 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Mon, 22 Apr 2013 23:12:15 -0400 Subject: Add set_consume which always takes ownership Freeing in error path is the common pattern with set_put(). --- src/tmpfiles/tmpfiles.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/tmpfiles/tmpfiles.c') diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 535381c470..f4885ec942 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -186,13 +186,9 @@ static void load_unix_sockets(void) { path_kill_slashes(s); - k = set_put(unix_sockets, s); - if (k < 0) { - free(s); - - if (k != -EEXIST) - goto fail; - } + k = set_consume(unix_sockets, s); + if (k < 0 && k != -EEXIST) + goto fail; } return; -- cgit v1.2.3-54-g00ecf