Skip to content

Commit

Permalink
bus-polkit: use _cleanup_
Browse files Browse the repository at this point in the history
  • Loading branch information
dtardon committed Feb 10, 2023
1 parent 7f6d3fa commit bcf3e64
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/shared/bus-polkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static int async_polkit_query_new(
const char **details,
AsyncPolkitQuery **ret)
{
AsyncPolkitQuery *q;
_cleanup_(async_polkit_query_freep) AsyncPolkitQuery *q = NULL;

assert(parent);
assert(request);
Expand All @@ -268,20 +268,16 @@ static int async_polkit_query_new(
};

q->action = strdup(action);
if (!q->action) {
async_polkit_query_free(q);
if (!q->action)
return -ENOMEM;
}

q->details = strv_copy((char**) details);
if (!q->details) {
async_polkit_query_free(q);
if (!q->details)
return -ENOMEM;
}

LIST_PREPEND(item, parent->items, q);

*ret = q;
*ret = TAKE_PTR(q);

return 0;
}
Expand Down

0 comments on commit bcf3e64

Please sign in to comment.