tree-wide: use _cleanup_set_free_ and friends

Instead of _cleanup_(set_freep) or so.
This commit is contained in:
Yu Watanabe
2023-06-01 06:47:48 +09:00
parent 64377c6089
commit 5d2a48da12
52 changed files with 94 additions and 94 deletions
+1 -1
View File
@@ -854,7 +854,7 @@ static int boot_entries_find_unified(
const char *root,
const char *dir) {
_cleanup_(closedirp) DIR *d = NULL;
_cleanup_closedir_ DIR *d = NULL;
_cleanup_free_ char *full = NULL;
int r;
+1 -1
View File
@@ -206,7 +206,7 @@ int copy_data_fd(int fd) {
/* Hmm, pity, this didn't fit. Let's fall back to /tmp then, see below */
} else {
_cleanup_(close_pairp) int pipefds[2] = PIPE_EBADF;
_cleanup_close_pair_ int pipefds[2] = PIPE_EBADF;
int isz;
/* If memfds aren't available, use a pipe. Set O_NONBLOCK so that we will get EAGAIN rather
+2 -2
View File
@@ -570,7 +570,7 @@ static int parse_core(int fd, const char *executable, char **ret, JsonVariant **
};
_cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL;
_cleanup_(set_freep) Set *modules = NULL;
_cleanup_set_free_ Set *modules = NULL;
_cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_destroy) */
_cleanup_(stack_context_destroy) StackContext c = {
.package_metadata = &package_metadata,
@@ -636,7 +636,7 @@ static int parse_core(int fd, const char *executable, char **ret, JsonVariant **
static int parse_elf(int fd, const char *executable, char **ret, JsonVariant **ret_package_metadata) {
_cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL, *elf_metadata = NULL;
_cleanup_(set_freep) Set *modules = NULL;
_cleanup_set_free_ Set *modules = NULL;
_cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_destroy) */
_cleanup_(stack_context_destroy) StackContext c = {
.package_metadata = &package_metadata,
+1 -1
View File
@@ -64,7 +64,7 @@ static int keymap_recurse_dir_callback(
}
int get_keymaps(char ***ret) {
_cleanup_(set_free_freep) Set *keymaps = NULL;
_cleanup_set_free_free_ Set *keymaps = NULL;
int r;
keymaps = set_new(&string_hash_ops);
+1 -1
View File
@@ -820,7 +820,7 @@ int fido2_generate_hmac_hash(
"Token asks for PIN but doesn't advertise 'clientPin' feature.");
for (;;) {
_cleanup_(strv_free_erasep) char **pin = NULL;
_cleanup_strv_free_erase_ char **pin = NULL;
r = ask_password_auto("Please enter security token PIN:", askpw_icon_name, NULL, "fido2-pin", "fido2-pin", USEC_INFINITY, 0, &pin);
if (r < 0)
+1 -1
View File
@@ -548,7 +548,7 @@ int make_filesystem(
}
int mkfs_options_from_env(const char *component, const char *fstype, char ***ret) {
_cleanup_(strv_freep) char **l = NULL;
_cleanup_strv_free_ char **l = NULL;
const char *e;
char *n;
+1 -1
View File
@@ -222,7 +222,7 @@ int battery_is_discharging_and_low(void) {
/* Store current capacity of each battery before suspension and timestamp */
int fetch_batteries_capacity_by_name(Hashmap **ret) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
_cleanup_(hashmap_freep) Hashmap *batteries_capacity_by_name = NULL;
_cleanup_hashmap_free_ Hashmap *batteries_capacity_by_name = NULL;
sd_device *dev;
int r;
+2 -2
View File
@@ -2847,7 +2847,7 @@ int tpm2_unseal(const char *device,
int tpm2_list_devices(void) {
#if HAVE_TPM2
_cleanup_(table_unrefp) Table *t = NULL;
_cleanup_(closedirp) DIR *d = NULL;
_cleanup_closedir_ DIR *d = NULL;
int r;
r = dlopen_tpm2();
@@ -2923,7 +2923,7 @@ int tpm2_find_device_auto(
int log_level, /* log level when no device is found */
char **ret) {
#if HAVE_TPM2
_cleanup_(closedirp) DIR *d = NULL;
_cleanup_closedir_ DIR *d = NULL;
int r;
r = dlopen_tpm2();
+2 -2
View File
@@ -395,8 +395,8 @@ static int userdb_start_query(
JsonVariant *query,
UserDBFlags flags) {
_cleanup_(strv_freep) char **except = NULL, **only = NULL;
_cleanup_(closedirp) DIR *d = NULL;
_cleanup_strv_free_ char **except = NULL, **only = NULL;
_cleanup_closedir_ DIR *d = NULL;
const char *e;
int r, ret = 0;