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