diff --git a/src/basic/capability-util.h b/src/basic/capability-util.h index f5ce2905241..d9489d7883c 100644 --- a/src/basic/capability-util.h +++ b/src/basic/capability-util.h @@ -25,7 +25,7 @@ int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities); int drop_capability(cap_value_t cv); -DEFINE_TRIVIAL_CLEANUP_FUNC(cap_t, cap_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(cap_t, cap_free, NULL); #define _cleanup_cap_free_ _cleanup_(cap_freep) static inline void cap_free_charpp(char **p) { diff --git a/src/basic/dlfcn-util.h b/src/basic/dlfcn-util.h index e0944f3aaf4..aa713d328bc 100644 --- a/src/basic/dlfcn-util.h +++ b/src/basic/dlfcn-util.h @@ -5,7 +5,7 @@ #include "macro.h" -DEFINE_TRIVIAL_CLEANUP_FUNC(void*, dlclose); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(void*, dlclose, NULL); int dlsym_many_and_warn(void *dl, int level, ...); diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index 2162537b808..f05c2b5a15d 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -41,8 +41,8 @@ static inline void fclosep(FILE **f) { safe_fclose(*f); } -DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, pclose); -DEFINE_TRIVIAL_CLEANUP_FUNC(DIR*, closedir); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(FILE*, pclose, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(DIR*, closedir, NULL); #define _cleanup_close_ _cleanup_(closep) #define _cleanup_fclose_ _cleanup_(fclosep) diff --git a/src/basic/fileio.c b/src/basic/fileio.c index f4708bc05f0..21532515fbd 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -1146,7 +1146,7 @@ static EndOfLineMarker categorize_eol(char c, ReadLineFlags flags) { return EOL_NONE; } -DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, funlockfile); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(FILE*, funlockfile, NULL); int read_line_full(FILE *f, size_t limit, ReadLineFlags flags, char **ret) { size_t n = 0, allocated = 0, count = 0; diff --git a/src/basic/gcrypt-util.h b/src/basic/gcrypt-util.h index c07b36cdb9f..27dcc72028d 100644 --- a/src/basic/gcrypt-util.h +++ b/src/basic/gcrypt-util.h @@ -14,7 +14,7 @@ void initialize_libgcrypt(bool secmem); int string_hashsum(const char *s, size_t len, int md_algorithm, char **out); -DEFINE_TRIVIAL_CLEANUP_FUNC(gcry_md_hd_t, gcry_md_close); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gcry_md_hd_t, gcry_md_close, NULL); #endif static inline int string_hashsum_sha224(const char *s, size_t len, char **out) { diff --git a/src/basic/macro.h b/src/basic/macro.h index d4e3d3b8fb7..eebd0769dde 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -405,10 +405,20 @@ static inline int __coverity_check_and_return__(int condition) { func(p); \ } +/* When func() returns the void value (NULL, -1, …) of the appropriate type */ #define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ static inline void func##p(type *p) { \ if (*p) \ + *p = func(*p); \ + } + +/* When func() doesn't return the appropriate type, set variable to empty afterwards */ +#define DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(type, func, empty) \ + static inline void func##p(type *p) { \ + if (*p != (empty)) { \ func(*p); \ + *p = (empty); \ + } \ } #define _DEFINE_TRIVIAL_REF_FUNC(type, name, scope) \ diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index bd22500b7ed..cfc8464c66d 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -29,7 +29,7 @@ #include "time-util.h" #if HAVE_SELINUX -DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(context_t, context_free, NULL); #define _cleanup_context_free_ _cleanup_(context_freep) static int mac_selinux_reload(int seqno); diff --git a/src/basic/selinux-util.h b/src/basic/selinux-util.h index 1236d6efdfe..1095bdef0ee 100644 --- a/src/basic/selinux-util.h +++ b/src/basic/selinux-util.h @@ -11,7 +11,7 @@ #if HAVE_SELINUX #include -DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, freecon, NULL); #define _cleanup_freecon_ _cleanup_(freeconp) #endif diff --git a/src/core/apparmor-setup.c b/src/core/apparmor-setup.c index e856f5c1831..304a3e6aac2 100644 --- a/src/core/apparmor-setup.c +++ b/src/core/apparmor-setup.c @@ -16,17 +16,17 @@ #include "strv.h" #if HAVE_APPARMOR -DEFINE_TRIVIAL_CLEANUP_FUNC(aa_policy_cache *, aa_policy_cache_unref); -DEFINE_TRIVIAL_CLEANUP_FUNC(aa_features *, aa_features_unref); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(aa_policy_cache *, aa_policy_cache_unref, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(aa_features *, aa_features_unref, NULL); #endif int mac_apparmor_setup(void) { #if HAVE_APPARMOR - int r; _cleanup_(aa_policy_cache_unrefp) aa_policy_cache *policy_cache = NULL; _cleanup_(aa_features_unrefp) aa_features *features = NULL; const char *current_file; _cleanup_free_ char *current_profile = NULL, *cache_dir_path = NULL; + int r; if (!mac_apparmor_use()) { log_debug("AppArmor either not supported by the kernel or disabled."); diff --git a/src/core/socket.c b/src/core/socket.c index 5631054ccee..e9cacfdf3a2 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1611,7 +1611,7 @@ static int socket_address_listen_in_cgroup( return fd; } -DEFINE_TRIVIAL_CLEANUP_FUNC(Socket *, socket_close_fds); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(Socket *, socket_close_fds, NULL); static int socket_open_fds(Socket *orig_s) { _cleanup_(socket_close_fdsp) Socket *s = orig_s; diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 91cabd5cef3..1b13002627f 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -1343,7 +1343,7 @@ static int manager_load_key_pair(Manager *m) { return 1; } -DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_PKEY_CTX*, EVP_PKEY_CTX_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(EVP_PKEY_CTX*, EVP_PKEY_CTX_free, NULL); static int manager_generate_key_pair(Manager *m) { _cleanup_(EVP_PKEY_CTX_freep) EVP_PKEY_CTX *ctx = NULL; @@ -1454,7 +1454,7 @@ int manager_sign_user_record(Manager *m, UserRecord *u, UserRecord **ret, sd_bus } DEFINE_PRIVATE_HASH_OPS_FULL(public_key_hash_ops, char, string_hash_func, string_compare_func, free, EVP_PKEY, EVP_PKEY_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_PKEY*, EVP_PKEY_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(EVP_PKEY*, EVP_PKEY_free, NULL); static int manager_load_public_key_one(Manager *m, const char *path) { _cleanup_(EVP_PKEY_freep) EVP_PKEY *pkey = NULL; diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index c6b34d28d40..1d012c5d02b 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -1592,10 +1592,10 @@ static int luks_format( return 0; } -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_context*, fdisk_unref_context); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_partition*, fdisk_unref_partition); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_parttype*, fdisk_unref_parttype); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_table*, fdisk_unref_table); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_context*, fdisk_unref_context, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_partition*, fdisk_unref_partition, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_parttype*, fdisk_unref_parttype, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_table*, fdisk_unref_table, NULL); static int make_partition_table( int fd, diff --git a/src/home/user-record-sign.c b/src/home/user-record-sign.c index 8cd3a462513..5ac92255c8b 100644 --- a/src/home/user-record-sign.c +++ b/src/home/user-record-sign.c @@ -27,7 +27,7 @@ static int user_record_signable_json(UserRecord *ur, char **ret) { return json_variant_format(j, 0, ret); } -DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_MD_CTX*, EVP_MD_CTX_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(EVP_MD_CTX*, EVP_MD_CTX_free, NULL); int user_record_sign(UserRecord *ur, EVP_PKEY *private_key, UserRecord **ret) { _cleanup_(json_variant_unrefp) JsonVariant *encoded = NULL, *v = NULL; diff --git a/src/import/curl-util.h b/src/import/curl-util.h index 4ab52d73a4f..6b4f992fe70 100644 --- a/src/import/curl-util.h +++ b/src/import/curl-util.h @@ -34,6 +34,6 @@ struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_; int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value); int curl_parse_http_time(const char *t, usec_t *ret); -DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup); -DEFINE_TRIVIAL_CLEANUP_FUNC(CURLM*, curl_multi_cleanup); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(CURL*, curl_easy_cleanup, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(CURLM*, curl_multi_cleanup, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct curl_slist*, curl_slist_free_all, NULL); diff --git a/src/journal-remote/microhttpd-util.h b/src/journal-remote/microhttpd-util.h index 7f90a09c777..a92ba57d0fa 100644 --- a/src/journal-remote/microhttpd-util.h +++ b/src/journal-remote/microhttpd-util.h @@ -80,5 +80,5 @@ int check_permissions(struct MHD_Connection *connection, int *code, char **hostn */ int setup_gnutls_logger(char **categories); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct MHD_Daemon*, MHD_stop_daemon); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct MHD_Response*, MHD_destroy_response); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct MHD_Daemon*, MHD_stop_daemon, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct MHD_Response*, MHD_destroy_response, NULL); diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index a1b7bee2a3b..3de3b4e26f0 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -166,8 +166,8 @@ typedef struct BootId { } BootId; #if HAVE_PCRE2 -DEFINE_TRIVIAL_CLEANUP_FUNC(pcre2_match_data*, sym_pcre2_match_data_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(pcre2_code*, sym_pcre2_code_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_match_data*, sym_pcre2_match_data_free, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_code*, sym_pcre2_code_free, NULL); static int pattern_compile(const char *pattern, unsigned flags, pcre2_code **out) { int errorcode, r; diff --git a/src/libsystemd/sd-journal/compress.c b/src/libsystemd/sd-journal/compress.c index 429dbadb6c9..3ea3328c1e4 100644 --- a/src/libsystemd/sd-journal/compress.c +++ b/src/libsystemd/sd-journal/compress.c @@ -34,13 +34,13 @@ #include "util.h" #if HAVE_LZ4 -DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_compressionContext_t, LZ4F_freeCompressionContext); -DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_decompressionContext_t, LZ4F_freeDecompressionContext); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(LZ4F_compressionContext_t, LZ4F_freeCompressionContext, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(LZ4F_decompressionContext_t, LZ4F_freeDecompressionContext, NULL); #endif #if HAVE_ZSTD -DEFINE_TRIVIAL_CLEANUP_FUNC(ZSTD_CCtx *, ZSTD_freeCCtx); -DEFINE_TRIVIAL_CLEANUP_FUNC(ZSTD_DCtx *, ZSTD_freeDCtx); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(ZSTD_CCtx*, ZSTD_freeCCtx, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(ZSTD_DCtx*, ZSTD_freeDCtx, NULL); static int zstd_ret_to_errno(size_t ret) { switch (ZSTD_getErrorCode(ret)) { diff --git a/src/partition/repart.c b/src/partition/repart.c index 78c31187ea4..01e60e21334 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -1268,10 +1268,10 @@ static int context_read_definitions( return 0; } -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_context*, fdisk_unref_context); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_partition*, fdisk_unref_partition); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_parttype*, fdisk_unref_parttype); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct fdisk_table*, fdisk_unref_table); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_context*, fdisk_unref_context, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_partition*, fdisk_unref_partition, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_parttype*, fdisk_unref_parttype, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_table*, fdisk_unref_table, NULL); static int determine_current_padding( struct fdisk_context *c, diff --git a/src/resolve/resolved-dnstls-gnutls.c b/src/resolve/resolved-dnstls-gnutls.c index d3edd350b39..e7ccba934e5 100644 --- a/src/resolve/resolved-dnstls-gnutls.c +++ b/src/resolve/resolved-dnstls-gnutls.c @@ -11,7 +11,7 @@ #include "resolved-manager.h" #define TLS_PROTOCOL_PRIORITY "NORMAL:-VERS-ALL:+VERS-TLS1.3:+VERS-TLS1.2" -DEFINE_TRIVIAL_CLEANUP_FUNC(gnutls_session_t, gnutls_deinit); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gnutls_session_t, gnutls_deinit, NULL); static ssize_t dnstls_stream_writev(gnutls_transport_ptr_t p, const giovec_t *iov, int iovcnt) { int r; diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h index 837e8699ee9..03595c66515 100644 --- a/src/shared/acl-util.h +++ b/src/shared/acl-util.h @@ -21,13 +21,13 @@ int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask); /* acl_free takes multiple argument types. * Multiple cleanup functions are necessary. */ -DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(acl_t, acl_free, NULL); #define acl_free_charp acl_free -DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, acl_free_charp, NULL); #define acl_free_uid_tp acl_free -DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(uid_t*, acl_free_uid_tp, NULL); #define acl_free_gid_tp acl_free -DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gid_t*, acl_free_gid_tp, NULL); #else #define ACL_READ 0x04 diff --git a/src/shared/blkid-util.h b/src/shared/blkid-util.h index 3f38e9b3089..aa444990fd8 100644 --- a/src/shared/blkid-util.h +++ b/src/shared/blkid-util.h @@ -6,5 +6,5 @@ # include "macro.h" -DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(blkid_probe, blkid_free_probe, NULL); #endif diff --git a/src/shared/cryptsetup-util.h b/src/shared/cryptsetup-util.h index 454bfa45327..5ebb0ac576a 100644 --- a/src/shared/cryptsetup-util.h +++ b/src/shared/cryptsetup-util.h @@ -50,8 +50,8 @@ static inline int sym_crypt_token_max(_unused_ const char *type) { int dlopen_cryptsetup(void); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct crypt_device *, crypt_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct crypt_device *, sym_crypt_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct crypt_device *, crypt_free, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct crypt_device *, sym_crypt_free, NULL); void cryptsetup_enable_logging(struct crypt_device *cd); diff --git a/src/shared/firewall-util-iptables.c b/src/shared/firewall-util-iptables.c index fec3000e751..982c61d8fbd 100644 --- a/src/shared/firewall-util-iptables.c +++ b/src/shared/firewall-util-iptables.c @@ -27,7 +27,7 @@ #include "macro.h" #include "socket-util.h" -DEFINE_TRIVIAL_CLEANUP_FUNC(struct xtc_handle*, iptc_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct xtc_handle*, iptc_free, NULL); static int entry_fill_basics( struct ipt_entry *entry, diff --git a/src/shared/libmount-util.h b/src/shared/libmount-util.h index db9728c332a..cf19c56ed12 100644 --- a/src/shared/libmount-util.h +++ b/src/shared/libmount-util.h @@ -8,8 +8,8 @@ #include "macro.h" -DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_table*, mnt_free_table); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_iter*, mnt_free_iter); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_table*, mnt_free_table, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_iter*, mnt_free_iter, NULL); static inline int libmount_parse( const char *path, diff --git a/src/shared/module-util.h b/src/shared/module-util.h index 4db8c5f04ed..8ca6a06a070 100644 --- a/src/shared/module-util.h +++ b/src/shared/module-util.h @@ -7,6 +7,6 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_ctx*, kmod_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_module*, kmod_module_unref); -DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_list*, kmod_module_unref_list); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct kmod_list*, kmod_module_unref_list, NULL); int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool verbose); diff --git a/src/shared/mount-util.h b/src/shared/mount-util.h index 849c37e85b1..71838976860 100644 --- a/src/shared/mount-util.h +++ b/src/shared/mount-util.h @@ -45,7 +45,7 @@ int bind_remount_one_with_mountinfo(const char *path, unsigned long new_flags, u int mount_move_root(const char *path); -DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(FILE*, endmntent, NULL); #define _cleanup_endmntent_ _cleanup_(endmntentp) int mount_verbose_full( diff --git a/src/shared/openssl-util.h b/src/shared/openssl-util.h index b753a690bab..0f527e74c40 100644 --- a/src/shared/openssl-util.h +++ b/src/shared/openssl-util.h @@ -6,10 +6,10 @@ #if HAVE_OPENSSL # include -DEFINE_TRIVIAL_CLEANUP_FUNC(X509*, X509_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(X509_NAME*, X509_NAME_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_PKEY_CTX*, EVP_PKEY_CTX_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(EVP_CIPHER_CTX*, EVP_CIPHER_CTX_free); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(X509*, X509_free, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(X509_NAME*, X509_NAME_free, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(EVP_PKEY_CTX*, EVP_PKEY_CTX_free, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(EVP_CIPHER_CTX*, EVP_CIPHER_CTX_free, NULL); int rsa_encrypt_bytes(EVP_PKEY *pkey, const void *decrypted_key, size_t decrypted_key_size, void **ret_encrypt_key, size_t *ret_encrypt_key_size); diff --git a/src/shared/pkcs11-util.h b/src/shared/pkcs11-util.h index 3fa2505deb3..f32ab304299 100644 --- a/src/shared/pkcs11-util.h +++ b/src/shared/pkcs11-util.h @@ -21,8 +21,8 @@ P11KitUri *uri_from_module_info(const CK_INFO *info); P11KitUri *uri_from_slot_info(const CK_SLOT_INFO *slot_info); P11KitUri *uri_from_token_info(const CK_TOKEN_INFO *token_info); -DEFINE_TRIVIAL_CLEANUP_FUNC(P11KitUri*, p11_kit_uri_free); -DEFINE_TRIVIAL_CLEANUP_FUNC(CK_FUNCTION_LIST**, p11_kit_modules_finalize_and_release); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(P11KitUri*, p11_kit_uri_free, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(CK_FUNCTION_LIST**, p11_kit_modules_finalize_and_release, NULL); CK_RV pkcs11_get_slot_list_malloc(CK_FUNCTION_LIST *m, CK_SLOT_ID **ret_slotids, CK_ULONG *ret_n_slotids); diff --git a/src/shared/pwquality-util.h b/src/shared/pwquality-util.h index de288bb017c..877f439d117 100644 --- a/src/shared/pwquality-util.h +++ b/src/shared/pwquality-util.h @@ -19,7 +19,7 @@ extern const char* (*sym_pwquality_strerror)(char *buf, size_t len, int errcode, int dlopen_pwquality(void); -DEFINE_TRIVIAL_CLEANUP_FUNC(pwquality_settings_t*, sym_pwquality_free_settings); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pwquality_settings_t*, sym_pwquality_free_settings, NULL); void pwq_maybe_disable_dictionary(pwquality_settings_t *pwq); int pwq_allocate_context(pwquality_settings_t **ret); diff --git a/src/shared/seccomp-util.h b/src/shared/seccomp-util.h index ee6f7b878bd..b3d25c9f3f3 100644 --- a/src/shared/seccomp-util.h +++ b/src/shared/seccomp-util.h @@ -121,7 +121,7 @@ extern uint32_t seccomp_local_archs[]; #define ERRNO_IS_SECCOMP_FATAL(r) \ IN_SET(abs(r), EPERM, EACCES, ENOMEM, EFAULT) -DEFINE_TRIVIAL_CLEANUP_FUNC(scmp_filter_ctx, seccomp_release); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(scmp_filter_ctx, seccomp_release, NULL); int parse_syscall_archs(char **l, Set **ret_archs); diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 61090a6e4af..3d563547190 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -167,7 +167,7 @@ static void udev_ctrl_disconnect_and_listen_again(struct udev_ctrl *uctrl) { /* We don't return NULL here because uctrl is not freed */ } -DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl *, udev_ctrl_disconnect_and_listen_again); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct udev_ctrl*, udev_ctrl_disconnect_and_listen_again, NULL); static int udev_ctrl_connection_event_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata) { _cleanup_(udev_ctrl_disconnect_and_listen_againp) struct udev_ctrl *uctrl = NULL;