tree-wide: use _cleanup_hashmap_free_ and friends

This commit is contained in:
Yu Watanabe
2025-01-19 03:48:15 +09:00
parent 8af1b296cb
commit fe5a1afb67
14 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -376,7 +376,7 @@ static int vl_method_ask(sd_varlink *link, sd_json_variant *parameters, sd_varli
static int vl_server(void) {
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *varlink_server = NULL;
_cleanup_(hashmap_freep) Hashmap *polkit_registry = NULL;
_cleanup_hashmap_free_ Hashmap *polkit_registry = NULL;
int r;
r = varlink_server_new(&varlink_server, SD_VARLINK_SERVER_INHERIT_USERDATA, /* userdata= */ &polkit_registry);
+1 -1
View File
@@ -558,7 +558,7 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
}
int userns_enter_and_pin(int userns_fd, pid_t *ret_pid) {
_cleanup_(close_pairp) int pfd[2] = EBADF_PAIR;
_cleanup_close_pair_ int pfd[2] = EBADF_PAIR;
_cleanup_(sigkill_waitp) pid_t pid = 0;
ssize_t n;
char x;
+1 -1
View File
@@ -1120,7 +1120,7 @@ static int ask_password_conv(
.until = now(CLOCK_MONOTONIC) + 15 * USEC_PER_SEC,
};
_cleanup_(strv_free_erasep) char **acquired = NULL;
_cleanup_strv_free_erase_ char **acquired = NULL;
r = ask_password_auto(
&req,
ASK_PASSWORD_ACCEPT_CACHED|
+1 -1
View File
@@ -1425,7 +1425,7 @@ static int run(int argc, char *argv[]) {
if (arg_varlink) {
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *varlink_server = NULL;
_cleanup_(hashmap_freep) Hashmap *polkit_registry = NULL;
_cleanup_hashmap_free_ Hashmap *polkit_registry = NULL;
/* Invocation as Varlink service */
+1 -1
View File
@@ -1370,7 +1370,7 @@ static int method_list_images(sd_bus_message *msg, void *userdata, sd_bus_error
class < 0 ? (c < _IMAGE_CLASS_MAX) : (c == class);
c++) {
_cleanup_(hashmap_freep) Hashmap *h = NULL;
_cleanup_hashmap_free_ Hashmap *h = NULL;
h = hashmap_new(&image_hash_ops);
if (!h)
+1 -1
View File
@@ -1010,7 +1010,7 @@ static int bind_description(sd_bus *b, int fd, int family) {
}
static int connect_as(int fd, const struct sockaddr *sa, socklen_t salen, uid_t uid, gid_t gid) {
_cleanup_(close_pairp) int pfd[2] = EBADF_PAIR;
_cleanup_close_pair_ int pfd[2] = EBADF_PAIR;
ssize_t n;
int r;
+2 -2
View File
@@ -1607,7 +1607,7 @@ static int varlink_idl_symbol_consistent(
const sd_varlink_symbol *symbol,
int level) {
_cleanup_(set_freep) Set *input_set = NULL, *output_set = NULL;
_cleanup_set_free_ Set *input_set = NULL, *output_set = NULL;
const char *symbol_name;
int r;
@@ -1654,7 +1654,7 @@ static int varlink_idl_symbol_consistent(
}
int varlink_idl_consistent(const sd_varlink_interface *interface, int level) {
_cleanup_(set_freep) Set *name_set = NULL;
_cleanup_set_free_ Set *name_set = NULL;
int r;
assert(interface);
+1 -1
View File
@@ -73,7 +73,7 @@ _public_ PAM_EXTERN int pam_sm_authenticate(
/* Split the key by NUL. Set the last item as authtok. */
_cleanup_(strv_free_erasep) char **passwords = strv_parse_nulstr(p, n);
_cleanup_strv_free_erase_ char **passwords = strv_parse_nulstr(p, n);
if (!passwords)
return pam_log_oom(handle);
+1 -1
View File
@@ -567,7 +567,7 @@ static int process_connection(sd_varlink_server *server, int _fd) {
static int run(int argc, char *argv[]) {
usec_t start_time, listen_idle_usec, last_busy_usec = USEC_INFINITY;
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *server = NULL;
_cleanup_(hashmap_freep) Hashmap *polkit_registry = NULL;
_cleanup_hashmap_free_ Hashmap *polkit_registry = NULL;
_cleanup_(pidref_done) PidRef parent = PIDREF_NULL;
unsigned n_iterations = 0;
int m, listen_fd, r;
+1 -1
View File
@@ -595,7 +595,7 @@ static int manager_setup_bpf(Manager *m) {
#endif
int manager_startup(Manager *m) {
_cleanup_(set_freep) Set *fdstore_inodes = NULL, *registry_inodes = NULL;
_cleanup_set_free_ Set *fdstore_inodes = NULL, *registry_inodes = NULL;
void *p;
int r;
+1 -1
View File
@@ -4548,7 +4548,7 @@ static int make_policy(bool force, RecoveryPinMode recovery_pin_mode) {
if (r < 0)
return log_error_errno(r, "Failed to acquire PIN from environment: %m");
if (r == 0) {
_cleanup_(strv_free_erasep) char **l = NULL;
_cleanup_strv_free_erase_ char **l = NULL;
AskPasswordRequest req = {
.tty_fd = -EBADF,
+1 -1
View File
@@ -612,7 +612,7 @@ DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
dns_stream_unref);
int dns_stream_disconnect_all(Manager *m) {
_cleanup_(set_freep) Set *closed = NULL;
_cleanup_set_free_ Set *closed = NULL;
int r;
assert(m);
+1 -1
View File
@@ -1398,7 +1398,7 @@ static int openssl_ask_password_ui_read(UI *ui, UI_STRING *uis) {
req->message = UI_get0_output_string(uis);
_cleanup_(strv_freep) char **l = NULL;
_cleanup_strv_free_ char **l = NULL;
r = ask_password_auto(req, ASK_PASSWORD_ACCEPT_CACHED|ASK_PASSWORD_PUSH_CACHE, &l);
if (r < 0) {
log_error_errno(r, "Failed to query for PIN: %m");
+1 -1
View File
@@ -646,7 +646,7 @@ TEST(hashmap_get) {
}
TEST(hashmap_get2) {
_cleanup_(hashmap_free_free_freep) Hashmap *m = NULL;
_cleanup_hashmap_free_free_free_ Hashmap *m = NULL;
char *r;
char *val;
char key_orig[] = "Key 1";