Add set_consume which always takes ownership

Freeing in error path is the common pattern with set_put().
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2013-04-24 00:25:04 -04:00
parent c79bb9e4e2
commit ef42202ac8
14 changed files with 40 additions and 59 deletions
+1 -2
View File
@@ -1843,9 +1843,8 @@ static int start_unit_one(
if (!p)
return log_oom();
r = set_put(s, p);
r = set_consume(s, p);
if (r < 0) {
free(p);
log_error("Failed to add path to set.");
return r;
}