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
@@ -100,7 +100,7 @@ static int add_pkcs11_token_uri(JsonVariant **v, const char *uri) {
int identity_add_token_pin(JsonVariant **v, const char *pin) {
_cleanup_(json_variant_unrefp) JsonVariant *w = NULL, *l = NULL;
_cleanup_(strv_free_erasep) char **pins = NULL;
_cleanup_strv_free_erase_ char **pins = NULL;
int r;
assert(v);
+1 -1
View File
@@ -67,7 +67,7 @@ static int add_public(JsonVariant **v) {
static int add_secret(JsonVariant **v, const char *password) {
_cleanup_(json_variant_unrefp) JsonVariant *w = NULL, *l = NULL;
_cleanup_(strv_free_erasep) char **passwords = NULL;
_cleanup_strv_free_erase_ char **passwords = NULL;
int r;
assert(v);
+7 -7
View File
@@ -210,7 +210,7 @@ static int acquire_existing_password(
bool emphasize_current,
AskPasswordFlags flags) {
_cleanup_(strv_free_erasep) char **password = NULL;
_cleanup_strv_free_erase_ char **password = NULL;
_cleanup_(erase_and_freep) char *envpw = NULL;
_cleanup_free_ char *question = NULL;
int r;
@@ -271,7 +271,7 @@ static int acquire_recovery_key(
UserRecord *hr,
AskPasswordFlags flags) {
_cleanup_(strv_free_erasep) char **recovery_key = NULL;
_cleanup_strv_free_erase_ char **recovery_key = NULL;
_cleanup_(erase_and_freep) char *envpw = NULL;
_cleanup_free_ char *question = NULL;
int r;
@@ -329,7 +329,7 @@ static int acquire_token_pin(
UserRecord *hr,
AskPasswordFlags flags) {
_cleanup_(strv_free_erasep) char **pin = NULL;
_cleanup_strv_free_erase_ char **pin = NULL;
_cleanup_(erase_and_freep) char *envpin = NULL;
_cleanup_free_ char *question = NULL;
int r;
@@ -699,7 +699,7 @@ static char **mangle_user_list(char **list, char ***ret_allocated) {
static int inspect_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(strv_freep) char **mangled_list = NULL;
_cleanup_strv_free_ char **mangled_list = NULL;
int r, ret = 0;
char **items;
@@ -783,7 +783,7 @@ static int inspect_home(int argc, char *argv[], void *userdata) {
static int authenticate_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(strv_freep) char **mangled_list = NULL;
_cleanup_strv_free_ char **mangled_list = NULL;
int r, ret = 0;
char **items;
@@ -1187,7 +1187,7 @@ static int acquire_new_password(
(void) suggest_passwords();
for (;;) {
_cleanup_(strv_free_erasep) char **first = NULL, **second = NULL;
_cleanup_strv_free_erase_ char **first = NULL, **second = NULL;
_cleanup_free_ char *question = NULL;
if (--i == 0)
@@ -3162,7 +3162,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_SSH_AUTHORIZED_KEYS: {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
_cleanup_(strv_freep) char **l = NULL, **add = NULL;
_cleanup_strv_free_ char **l = NULL, **add = NULL;
if (isempty(optarg)) {
r = drop_from_identity("sshAuthorizedKeys");
+1 -1
View File
@@ -36,7 +36,7 @@ static int property_get_auto_login(
return r;
HASHMAP_FOREACH(h, m->homes_by_name) {
_cleanup_(strv_freep) char **seats = NULL;
_cleanup_strv_free_ char **seats = NULL;
_cleanup_free_ char *home_path = NULL;
r = home_auto_login(h, &seats);
+1 -1
View File
@@ -1357,7 +1357,7 @@ static int manager_enumerate_devices(Manager *m) {
}
static int manager_load_key_pair(Manager *m) {
_cleanup_(fclosep) FILE *f = NULL;
_cleanup_fclose_ FILE *f = NULL;
struct stat st;
int r;
+1 -1
View File
@@ -60,7 +60,7 @@ int home_setup_cifs(
STRV_FOREACH(pw, h->password) {
_cleanup_(unlink_and_freep) char *p = NULL;
_cleanup_free_ char *options = NULL;
_cleanup_(fclosep) FILE *f = NULL;
_cleanup_fclose_ FILE *f = NULL;
pid_t mount_pid;
int exit_status;
+6 -6
View File
@@ -511,7 +511,7 @@ int home_sync_and_statfs(int root_fd, struct statfs *ret) {
}
static int read_identity_file(int root_fd, JsonVariant **ret) {
_cleanup_(fclosep) FILE *identity_file = NULL;
_cleanup_fclose_ FILE *identity_file = NULL;
_cleanup_close_ int identity_fd = -EBADF;
unsigned line, column;
int r;
@@ -542,7 +542,7 @@ static int read_identity_file(int root_fd, JsonVariant **ret) {
static int write_identity_file(int root_fd, JsonVariant *v, uid_t uid) {
_cleanup_(json_variant_unrefp) JsonVariant *normalized = NULL;
_cleanup_(fclosep) FILE *identity_file = NULL;
_cleanup_fclose_ FILE *identity_file = NULL;
_cleanup_close_ int identity_fd = -EBADF;
_cleanup_free_ char *fn = NULL;
int r;
@@ -1088,7 +1088,7 @@ static int user_record_compile_effective_passwords(
PasswordCache *cache,
char ***ret_effective_passwords) {
_cleanup_(strv_free_erasep) char **effective = NULL;
_cleanup_strv_free_erase_ char **effective = NULL;
size_t n;
int r;
@@ -1307,7 +1307,7 @@ static int determine_default_storage(UserStorage *ret) {
}
static int home_create(UserRecord *h, UserRecord **ret_home) {
_cleanup_(strv_free_erasep) char **effective_passwords = NULL;
_cleanup_strv_free_erase_ char **effective_passwords = NULL;
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
_cleanup_(password_cache_free) PasswordCache cache = {};
@@ -1679,7 +1679,7 @@ static int home_resize(UserRecord *h, bool automatic, UserRecord **ret) {
static int home_passwd(UserRecord *h, UserRecord **ret_home) {
_cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *embedded_home = NULL, *new_home = NULL;
_cleanup_(strv_free_erasep) char **effective_passwords = NULL;
_cleanup_strv_free_erase_ char **effective_passwords = NULL;
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
_cleanup_(password_cache_free) PasswordCache cache = {};
HomeSetupFlags flags = 0;
@@ -1850,7 +1850,7 @@ static int home_unlock(UserRecord *h) {
static int run(int argc, char *argv[]) {
_cleanup_(user_record_unrefp) UserRecord *home = NULL, *new_home = NULL;
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
_cleanup_(fclosep) FILE *opened_file = NULL;
_cleanup_fclose_ FILE *opened_file = NULL;
unsigned line = 0, column = 0;
const char *json_path = NULL;
FILE *json_file;
+2 -2
View File
@@ -871,7 +871,7 @@ int user_record_set_hashed_password(UserRecord *h, char **hashed_password) {
int user_record_set_password(UserRecord *h, char **password, bool prepend) {
_cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
_cleanup_(strv_free_erasep) char **e = NULL;
_cleanup_strv_free_erase_ char **e = NULL;
int r;
assert(h);
@@ -933,7 +933,7 @@ int user_record_set_password(UserRecord *h, char **password, bool prepend) {
int user_record_set_token_pin(UserRecord *h, char **pin, bool prepend) {
_cleanup_(json_variant_unrefp) JsonVariant *w = NULL;
_cleanup_(strv_free_erasep) char **e = NULL;
_cleanup_strv_free_erase_ char **e = NULL;
int r;
assert(h);