Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user