diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-22 23:12:15 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-24 00:25:04 -0400 |
commit | ef42202ac8ed27e7ff1fc90ef8bc2590046dff25 (patch) | |
tree | b1646eeb8ef5070337ae701ffb4abf0e398640ad /src/shared/install.c | |
parent | c79bb9e4e2e5b96b2ae2c432bf8b0ff9674fce60 (diff) |
Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
Diffstat (limited to 'src/shared/install.c')
-rw-r--r-- | src/shared/install.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 959de04810..b22019d7b5 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -178,11 +178,9 @@ static int mark_symlink_for_removal( path_kill_slashes(n); - r = set_put(*remove_symlinks_to, n); - if (r < 0) { - free(n); + r = set_consume(*remove_symlinks_to, n); + if (r < 0) return r == -EEXIST ? 0 : r; - } return 0; } |