Skip to content

Commit b1ebc20

Browse files
committed
bus-polkit: avoid extra variable
1 parent 2f50a4f commit b1ebc20

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/shared/bus-polkit.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ int bus_verify_polkit_async(
490490
return r;
491491

492492
#if ENABLE_POLKIT
493-
AsyncPolkitQuery *q = hashmap_get(*registry, call);
493+
_cleanup_(async_polkit_query_unrefp) AsyncPolkitQuery *q = NULL;
494+
495+
q = async_polkit_query_ref(hashmap_get(*registry, call));
494496
/* This is a repeated invocation of this function, hence let's check if we've already got
495497
* a response from polkit for this action */
496498
if (q) {
@@ -508,7 +510,6 @@ int bus_verify_polkit_async(
508510

509511
#if ENABLE_POLKIT
510512
_cleanup_(sd_bus_message_unrefp) sd_bus_message *pk = NULL;
511-
_cleanup_(async_polkit_query_unrefp) AsyncPolkitQuery *q_new = NULL;
512513

513514
int c = sd_bus_message_get_allow_interactive_authorization(call);
514515
if (c < 0)
@@ -525,16 +526,15 @@ int bus_verify_polkit_async(
525526
return r;
526527

527528
if (!q) {
528-
q = q_new = new(AsyncPolkitQuery, 1);
529+
q = new(AsyncPolkitQuery, 1);
529530
if (!q)
530531
return -ENOMEM;
531532

532533
*q = (AsyncPolkitQuery) {
533534
.n_ref = 1,
534535
.request = sd_bus_message_ref(call),
535536
};
536-
} else
537-
async_polkit_query_ref(q);
537+
}
538538

539539
assert(!q->action);
540540
q->action = new(AsyncPolkitQueryAction, 1);
@@ -560,7 +560,7 @@ int bus_verify_polkit_async(
560560
if (r < 0)
561561
return r;
562562

563-
TAKE_PTR(q_new);
563+
TAKE_PTR(q);
564564

565565
return 0;
566566
#endif

0 commit comments

Comments
 (0)