polkit: make bus_verify_polkit_async_registry_free() return Hashmap* with NULL
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Dec 2021 10:36:34 +0000 (19:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Dec 2021 10:39:39 +0000 (19:39 +0900)
src/shared/bus-polkit.c
src/shared/bus-polkit.h

index 14122e0876a6bc6ecf46d51e0e58a652df174562..bbe04bea37f2a46e1cd8b6c73b09865ee935ad75 100644 (file)
@@ -408,8 +408,11 @@ int bus_verify_polkit_async(
         return -EACCES;
 }
 
-void bus_verify_polkit_async_registry_free(Hashmap *registry) {
+Hashmap *bus_verify_polkit_async_registry_free(Hashmap *registry) {
 #if ENABLE_POLKIT
-        hashmap_free_with_destructor(registry, async_polkit_query_free);
+        return hashmap_free_with_destructor(registry, async_polkit_query_free);
+#else
+        assert(hashmap_isempty(registry));
+        return hashmap_free(registry);
 #endif
 }
index 91a88a28079b9a341a4cfa64d014f31170b19b75..e2a3b7eef6659aa0bd1beb131649a432e462e63e 100644 (file)
@@ -8,4 +8,4 @@
 int bus_test_polkit(sd_bus_message *call, int capability, const char *action, const char **details, uid_t good_user, bool *_challenge, sd_bus_error *e);
 
 int bus_verify_polkit_async(sd_bus_message *call, int capability, const char *action, const char **details, bool interactive, uid_t good_user, Hashmap **registry, sd_bus_error *error);
-void bus_verify_polkit_async_registry_free(Hashmap *registry);
+Hashmap *bus_verify_polkit_async_registry_free(Hashmap *registry);