commit | ef42202ac8ed27e7ff1fc90ef8bc2590046dff25 | [log] [tgz] |
---|---|---|
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | Mon Apr 22 23:12:15 2013 -0400 |
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | Wed Apr 24 00:25:04 2013 -0400 |
tree | b1646eeb8ef5070337ae701ffb4abf0e398640ad | |
parent | c79bb9e4e2e5b96b2ae2c432bf8b0ff9674fce60 [diff] [blame] |
Add set_consume which always takes ownership Freeing in error path is the common pattern with set_put().
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 535381c..f4885ec 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c
@@ -186,13 +186,9 @@ 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;