]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: avoid uninitialized warning on _cleanup_ variables 19302/head
authorLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 12 Apr 2021 22:10:21 +0000 (23:10 +0100)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Wed, 14 Apr 2021 11:25:06 +0000 (12:25 +0100)
With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.

61 files changed:
src/activate/activate.c
src/basic/efivars.c
src/basic/path-lookup.c
src/basic/terminal-util.c
src/basic/time-util.c
src/boot/bless-boot.c
src/boot/bootctl.c
src/boot/efi/boot.c
src/boot/efi/stub.c
src/boot/efi/util.c
src/busctl/busctl.c
src/core/dbus-execute.c
src/core/dbus-path.c
src/core/execute.c
src/core/job.c
src/core/main.c
src/core/manager.c
src/core/namespace.c
src/core/service.c
src/core/unit.c
src/coredump/coredump.c
src/coredump/coredumpctl.c
src/cryptsetup/cryptsetup-keyfile.c
src/environment-d-generator/environment-d-generator.c
src/fstab-generator/fstab-generator.c
src/journal-remote/journal-gatewayd.c
src/journal-remote/journal-remote.c
src/journal/journalctl.c
src/journal/journald-stream.c
src/libsystemd-network/fuzz-dhcp6-client.c
src/libsystemd/sd-journal/journal-vacuum.c
src/libsystemd/sd-journal/sd-journal.c
src/libsystemd/sd-login/sd-login.c
src/locale/keymap-util.c
src/locale/localed.c
src/login/logind-core.c
src/login/logind-dbus.c
src/login/logind-session.c
src/machine/machine.c
src/network/netdev/tuntap.c
src/network/wait-online/wait-online.c
src/portable/portable.c
src/portable/portablectl.c
src/resolve/resolved-dns-scope.c
src/shared/acl-util.c
src/shared/bus-wait-for-jobs.c
src/shared/clean-ipc.c
src/shared/clock-util.c
src/shared/format-table.c
src/shared/install.c
src/shared/logs-show.c
src/shared/net-condition.c
src/shared/sleep-config.c
src/systemctl/systemctl-edit.c
src/systemctl/systemctl-list-units.c
src/systemctl/systemctl-show.c
src/sysv-generator/sysv-generator.c
src/timesync/wait-sync.c
src/tty-ask-password-agent/tty-ask-password-agent.c
src/udev/scsi_id/scsi_id.c
src/vconsole/vconsole-setup.c

index f298b1d49100f9a925df0922b4e5a88307054467..8c61c3ca7fc2eb091bfd30e6215343bf3fa921b7 100644 (file)
@@ -151,7 +151,7 @@ static int exec_process(const char *name, char **argv, char **env, int start_fd,
 
                         envp[n_env++] = k;
                 } else {
-                        _cleanup_free_ char *p;
+                        _cleanup_free_ char *p = NULL;
                         const char *n;
 
                         p = strjoin(*s, "=");
@@ -421,7 +421,7 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_FDNAME: {
-                        _cleanup_strv_free_ char **names;
+                        _cleanup_strv_free_ char **names = NULL;
                         char **s;
 
                         names = strv_split(optarg, ":");
@@ -430,7 +430,7 @@ static int parse_argv(int argc, char *argv[]) {
 
                         STRV_FOREACH(s, names)
                                 if (!fdname_is_valid(*s)) {
-                                        _cleanup_free_ char *esc;
+                                        _cleanup_free_ char *esc = NULL;
 
                                         esc = cescape(*s);
                                         log_warning("File descriptor name \"%s\" is not valid.", esc);
index 2139cf3a693ddeb7da217c5144bf978287f4bbe2..7e1e9e60476570faca59eac0fffdc9ca7b4aa714 100644 (file)
@@ -350,7 +350,7 @@ int cache_efi_options_variable(void) {
          * (NB: For testing purposes, we still check the $SYSTEMD_EFI_OPTIONS env var before accessing this
          * cache, even when in SecureBoot mode.) */
         if (is_efi_secure_boot()) {
-                _cleanup_free_ char *k;
+                _cleanup_free_ char *k = NULL;
 
                 k = efi_variable_path(EFI_VENDOR_SYSTEMD, "SystemdOptions");
                 if (!k)
index 96b82170d06d93b5ff2e360ae938dd4e692fbe8a..e53c2302b12722c2c3617d63ffc2fcefdb02b5cc 100644 (file)
@@ -772,7 +772,7 @@ void lookup_paths_log(LookupPaths *p) {
                 log_debug("Ignoring unit files.");
                 p->search_path = strv_free(p->search_path);
         } else {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = strv_join(p->search_path, "\n\t");
                 log_debug("Looking for unit files in (higher priority first):\n\t%s", strna(t));
index 1a3f9ccb33cd782ac773ca404b4c234580c13a7a..fafdaaa090e94274943e31d19074426433082691 100644 (file)
@@ -52,7 +52,7 @@ static volatile int cached_color_mode = _COLOR_INVALID;
 static volatile int cached_underline_enabled = -1;
 
 int chvt(int vt) {
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
 
         /* Switch to the specified vt number. If the VT is specified <= 0 switch to the VT the kernel log messages go,
          * if that's configured. */
@@ -514,7 +514,7 @@ int terminal_vhangup_fd(int fd) {
 }
 
 int terminal_vhangup(const char *name) {
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
 
         fd = open_terminal(name, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
         if (fd < 0)
index 3c2b25bd2a72039f14516457618b20c6c8eb7ea7..78d0390a00cb56bbc65ab9ac17229386b0a00386 100644 (file)
@@ -1547,7 +1547,7 @@ int time_change_fd(void) {
                 .it_value.tv_sec = TIME_T_MAX,
         };
 
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
 
         assert_cc(sizeof(time_t) == sizeof(TIME_T_MAX));
 
index bd6f64915d3353bf9053aa6c78a800a69d150a1a..97ad1e0cb5016124e27681fe7b6919da52b3b366 100644 (file)
@@ -126,7 +126,7 @@ static int acquire_path(void) {
         strv_free_and_replace(arg_path, a);
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *j;
+                _cleanup_free_ char *j = NULL;
 
                 j = strv_join(arg_path, ":");
                 log_debug("Using %s as boot loader drop-in search path.", j);
index 04cc7664e512bc2657f0e1a1cb1cf98724ba8f7d..a684717bb05bf060d32974293a439d47a3a3a44f 100644 (file)
@@ -312,7 +312,7 @@ static int status_variables(void) {
 }
 
 static int boot_entry_file_check(const char *root, const char *p) {
-        _cleanup_free_ char *path;
+        _cleanup_free_ char *path = NULL;
 
         path = path_join(root, p);
         if (!path)
index 35248db009bf48cfd46c04fac961d7890c27bcc1..24efe5de1dbc61fac8969841b77401c0a83efa7f 100644 (file)
@@ -456,7 +456,7 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {
 
                         device_path = DevicePathFromHandle(entry->device);
                         if (device_path) {
-                                _cleanup_freepool_ CHAR16 *str;
+                                _cleanup_freepool_ CHAR16 *str = NULL;
 
                                 str = DevicePathToStr(device_path);
                                 Print(L"device handle           '%s'\n", str);
index 1d9a5f07ab1ee61500afdebbf7bca13fa083a5e1..082fe91c9e5fd56599119d8a9e8f1a3980f2e86b 100644 (file)
@@ -92,7 +92,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
          * is non-NULL explicitly.) */
         if (efivar_get_raw(LOADER_GUID, L"LoaderImageIdentifier", NULL, NULL) != EFI_SUCCESS &&
             loaded_image->FilePath) {
-                _cleanup_freepool_ CHAR16 *s;
+                _cleanup_freepool_ CHAR16 *s = NULL;
 
                 s = DevicePathToStr(loaded_image->FilePath);
                 efivar_set(LOADER_GUID, L"LoaderImageIdentifier", s, 0);
@@ -100,7 +100,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
 
         /* if LoaderFirmwareInfo is not set, let's set it */
         if (efivar_get_raw(LOADER_GUID, L"LoaderFirmwareInfo", NULL, NULL) != EFI_SUCCESS) {
-                _cleanup_freepool_ CHAR16 *s;
+                _cleanup_freepool_ CHAR16 *s = NULL;
 
                 s = PoolPrint(L"%s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
                 efivar_set(LOADER_GUID, L"LoaderFirmwareInfo", s, 0);
@@ -108,7 +108,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
 
         /* ditto for LoaderFirmwareType */
         if (efivar_get_raw(LOADER_GUID, L"LoaderFirmwareType", NULL, NULL) != EFI_SUCCESS) {
-                _cleanup_freepool_ CHAR16 *s;
+                _cleanup_freepool_ CHAR16 *s = NULL;
 
                 s = PoolPrint(L"UEFI %d.%02d", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff);
                 efivar_set(LOADER_GUID, L"LoaderFirmwareType", s, 0);
index 06fbd500e579c2db250301d70f2262c4abefe678..0061e03eba2eda2b593abc26cc4787cdaa22a8c1 100644 (file)
@@ -379,7 +379,7 @@ EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN s
                 return err;
 
         if (size == 0) {
-                _cleanup_freepool_ EFI_FILE_INFO *info;
+                _cleanup_freepool_ EFI_FILE_INFO *info = NULL;
 
                 info = LibFileInfo(handle);
                 if (!info)
index cbc24bc2517f32300916551fc5f7e6b1a9a244ab..f081e98ae02e5589df817c3f4f8fdbddaf10a188 100644 (file)
@@ -797,7 +797,7 @@ static Set* member_set_free(Set *s) {
 DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, member_set_free);
 
 static int on_interface(const char *interface, uint64_t flags, void *userdata) {
-        _cleanup_(member_freep) Member *m;
+        _cleanup_(member_freep) Member *m = NULL;
         Set *members = userdata;
         int r;
 
@@ -828,7 +828,7 @@ static int on_interface(const char *interface, uint64_t flags, void *userdata) {
 }
 
 static int on_method(const char *interface, const char *name, const char *signature, const char *result, uint64_t flags, void *userdata) {
-        _cleanup_(member_freep) Member *m;
+        _cleanup_(member_freep) Member *m = NULL;
         Set *members = userdata;
         int r;
 
@@ -871,7 +871,7 @@ static int on_method(const char *interface, const char *name, const char *signat
 }
 
 static int on_signal(const char *interface, const char *name, const char *signature, uint64_t flags, void *userdata) {
-        _cleanup_(member_freep) Member *m;
+        _cleanup_(member_freep) Member *m = NULL;
         Set *members = userdata;
         int r;
 
@@ -910,7 +910,7 @@ static int on_signal(const char *interface, const char *name, const char *signat
 }
 
 static int on_property(const char *interface, const char *name, const char *signature, bool writable, uint64_t flags, void *userdata) {
-        _cleanup_(member_freep) Member *m;
+        _cleanup_(member_freep) Member *m = NULL;
         Set *members = userdata;
         int r;
 
index 3d4a06c0ff5acc116259ef56507dea49528d933f..3012c8786465f4c830b15f09fbcc01916024d4a5 100644 (file)
@@ -1627,7 +1627,7 @@ int bus_exec_context_set_transient_property(
 
                                 unit_write_settingf(u, flags, name, "RootHash=");
                         } else {
-                                _cleanup_free_ void *p;
+                                _cleanup_free_ void *p = NULL;
 
                                 encoded = hexmem(roothash_decoded, roothash_decoded_size);
                                 if (!encoded)
@@ -1673,7 +1673,7 @@ int bus_exec_context_set_transient_property(
 
                                 unit_write_settingf(u, flags, name, "RootHashSignature=");
                         } else {
-                                _cleanup_free_ void *p;
+                                _cleanup_free_ void *p = NULL;
                                 ssize_t len;
 
                                 len = base64mem(roothash_sig_decoded, roothash_sig_decoded_size, &encoded);
index 14e77d783dd929b25a17560907c4dcc48d2ae34f..e132cd2b3cf94f021b5f7223a1914bb4af007951 100644 (file)
@@ -96,7 +96,7 @@ static int bus_path_set_transient_property(
                                 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in %s is not absolute: %s", type_name, path);
 
                         if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
-                                _cleanup_free_ char *k;
+                                _cleanup_free_ char *k = NULL;
                                 PathSpec *s;
 
                                 k = strdup(path);
index 4d6b75e8458b8d95fafdd6f7064c61f3b621ab22..9f54ad424b141cdac2fb4e3728a02ff2c527d2e8 100644 (file)
@@ -4639,7 +4639,7 @@ static int exec_child(
                 final_argv = command->argv;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *line;
+                _cleanup_free_ char *line = NULL;
 
                 line = exec_command_line(final_argv);
                 if (line)
@@ -4933,7 +4933,7 @@ int exec_context_destroy_runtime_directory(const ExecContext *c, const char *run
                 return 0;
 
         STRV_FOREACH(i, c->directories[EXEC_DIRECTORY_RUNTIME].paths) {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 if (exec_directory_is_private(c, EXEC_DIRECTORY_RUNTIME))
                         p = path_join(runtime_prefix, "private", *i);
index 56c99f93eb1cee00455060d27e8aa8d723068be7..d313ebdb8ec8e473ae8f8cce442306e2fcb8ee82 100644 (file)
@@ -844,7 +844,7 @@ static void job_print_done_status_message(Unit *u, JobType t, JobResult result)
         REENABLE_WARNING;
 
         if (t == JOB_START && result == JOB_FAILED) {
-                _cleanup_free_ char *quoted;
+                _cleanup_free_ char *quoted = NULL;
 
                 quoted = shell_maybe_quote(u->id, ESCAPE_BACKSLASH);
                 manager_status_printf(u->manager, STATUS_TYPE_NORMAL, NULL, "See 'systemctl status %s' for details.", strna(quoted));
index 63254b4a9c83e7213932bd50b856338a6bbb4ec1..54ef7d182aff1f5cc4816ebcd4a6424ec46689b9 100644 (file)
@@ -2036,7 +2036,7 @@ static void log_execution_mode(bool *ret_first_boot) {
                 }
         } else {
                 if (DEBUG_LOGGING) {
-                        _cleanup_free_ char *t;
+                        _cleanup_free_ char *t = NULL;
 
                         t = uid_to_name(getuid());
                         log_debug("systemd " GIT_VERSION " running in %suser mode for user " UID_FMT "/%s. (%s)",
index f7f67065c6722ea79d3848c3ce1d57f5cda3010c..b41b6404647790c2a0364ad89730caca3d7b3012 100644 (file)
@@ -248,7 +248,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
 }
 
 static int have_ask_password(void) {
-        _cleanup_closedir_ DIR *dir;
+        _cleanup_closedir_ DIR *dir = NULL;
         struct dirent *de;
 
         dir = opendir("/run/systemd/ask-password");
index ccea336fee39e997eaade1b0f4d2688ff3a4d288..7eb42ee405e9272d1c2b339e8200c75643bc81df 100644 (file)
@@ -2092,7 +2092,7 @@ int setup_namespace(
                 }
 
                 if (log_namespace) {
-                        _cleanup_free_ char *q;
+                        _cleanup_free_ char *q = NULL;
 
                         q = strjoin("/run/systemd/journal.", log_namespace);
                         if (!q) {
@@ -2331,7 +2331,7 @@ int mount_image_add(MountImage **m, size_t *n, const MountImage *item) {
         }
 
         LIST_FOREACH(mount_options, i, item->mount_options) {
-                _cleanup_(mount_options_free_allp) MountOptions *o;
+                _cleanup_(mount_options_free_allp) MountOptions *o = NULL;
 
                 o = new(MountOptions, 1);
                 if (!o)
index 550db4063126337f8e03f1c3ad1c3ba16612441d..fb97bbeaae0b3088d768b5af45866d4454770eda 100644 (file)
@@ -4269,7 +4269,7 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context
         if (getpeername_pretty(fd, true, &peer) >= 0) {
 
                 if (UNIT(s)->description) {
-                        _cleanup_free_ char *a;
+                        _cleanup_free_ char *a = NULL;
 
                         a = strjoin(UNIT(s)->description, " (", peer, ")");
                         if (!a)
index cf83272dcbed6b01abfe3034206c9fa0ff377413..864bcd3d6e6c9dca19050c960d1ecc3788b685e4 100644 (file)
@@ -557,7 +557,7 @@ static void unit_free_requires_mounts_for(Unit *u) {
         assert(u);
 
         for (;;) {
-                _cleanup_free_ char *path;
+                _cleanup_free_ char *path = NULL;
 
                 path = hashmap_steal_first_key(u->requires_mounts_for);
                 if (!path)
@@ -1063,7 +1063,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
 
                 char **dp;
                 STRV_FOREACH(dp, c->directories[dt].paths) {
-                        _cleanup_free_ char *p;
+                        _cleanup_free_ char *p = NULL;
 
                         p = path_join(u->manager->prefix[dt], *dp);
                         if (!p)
@@ -2184,7 +2184,7 @@ static int unit_log_resources(Unit *u) {
         if (n_message_parts == 0)
                 t = strjoina("MESSAGE=", u->id, ": Completed.");
         else {
-                _cleanup_free_ char *joined;
+                _cleanup_free_ char *joined = NULL;
 
                 message_parts[n_message_parts] = NULL;
 
index b6cc7e3887f97497911a176ba1ab9790caf84748..62467d4cf940b42fd863ba2fcf16aacc24ba1f43 100644 (file)
@@ -588,7 +588,7 @@ static int compose_open_fds(pid_t pid, char **open_fds) {
 static int get_process_ns(pid_t pid, const char *namespace, ino_t *ns) {
         const char *p;
         struct stat stbuf;
-        _cleanup_close_ int proc_ns_dir_fd;
+        _cleanup_close_ int proc_ns_dir_fd = -1;
 
         p = procfs_file_alloca(pid, "ns");
 
index 02bad966c1cc7dd96bffc231889cd6f9d89c4003..9a577d47c8b7227120fea466b50bab436385ad78 100644 (file)
@@ -139,7 +139,7 @@ static int acquire_journal(sd_journal **ret, char **matches) {
                 return r;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *filter;
+                _cleanup_free_ char *filter = NULL;
 
                 filter = journal_make_match_string(j);
                 log_debug("Journal filter: %s", filter);
@@ -979,7 +979,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp)
 
         if (filename) {
 #if HAVE_COMPRESSION
-                _cleanup_close_ int fdf;
+                _cleanup_close_ int fdf = -1;
 
                 fdf = open(filename, O_RDONLY | O_CLOEXEC);
                 if (fdf < 0) {
index a6281fbdeeeafb616c4c75af4f8b0f39fce26ed3..55c1442ed6e7fb1d54b9ccd31f1cc3dd40507418 100644 (file)
@@ -33,7 +33,7 @@ int find_key_file(
         }
 
         STRV_FOREACH(i, search_path) {
-                _cleanup_free_ char *joined;
+                _cleanup_free_ char *joined = NULL;
 
                 joined = path_join(*i, key_file);
                 if (!joined)
index 1c51cf6b2cf7eb06d4a03e9e59e6459ec8ca3d09..852e29f11d47d1c0e199349a4806256d3bbd3641 100644 (file)
@@ -29,7 +29,7 @@ static int environment_dirs(char ***ret) {
                 return r;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = strv_join(dirs, "\n\t");
                 log_debug("Looking for environment.d files in (higher priority first):\n\t%s", strna(t));
index 8c1087a9a33b1d0fe9800ff869dd3e52e42bc574..69ba4bfc647083459ea0a1892fd9cbb7559a2cb1 100644 (file)
@@ -460,7 +460,7 @@ static int add_mount(
                 return r;
 
         if (!isempty(fstype) && !streq(fstype, "auto")) {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = specifier_escape(fstype);
                 if (!t)
index 4cefe3918c9d60dc4180dc7cbd9fa3c8f0d28a07..a2f166a881ba57ba6c132a3d222915ae1842f5ce 100644 (file)
@@ -311,7 +311,7 @@ static int request_parse_range(
 
                 colon2 = strchr(colon + 1, ':');
                 if (colon2) {
-                        _cleanup_free_ char *t;
+                        _cleanup_free_ char *t = NULL;
 
                         t = strndup(colon + 1, colon2 - colon - 1);
                         if (!t)
index 6f71248aaf31cf754652aa04d05d31b5c0fa73ab..9600e5f732475f26f2c37ccd2791bf2ab1d95569 100644 (file)
@@ -40,7 +40,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) {
                 break;
 
         case JOURNAL_WRITE_SPLIT_HOST: {
-                _cleanup_free_ char *name;
+                _cleanup_free_ char *name = NULL;
 
                 assert(host);
 
index 4b3e697855b34ab389e26c587410063129710fbe..b4a8bd1bfbb36abfc624104da3da1bc7bbb6c4ba 100644 (file)
@@ -1158,7 +1158,7 @@ static int add_matches(sd_journal *j, char **args) {
 
                         if (S_ISREG(st.st_mode) && (0111 & st.st_mode)) {
                                 if (executable_is_script(p, &interpreter) > 0) {
-                                        _cleanup_free_ char *comm;
+                                        _cleanup_free_ char *comm = NULL;
 
                                         comm = strndup(basename(p), 15);
                                         if (!comm)
@@ -1537,7 +1537,7 @@ static int get_possible_units(
                 char **patterns,
                 Set **units) {
 
-        _cleanup_set_free_free_ Set *found;
+        _cleanup_set_free_free_ Set *found = NULL;
         const char *field;
         int r;
 
@@ -2182,7 +2182,7 @@ int main(int argc, char *argv[]) {
         case ACTION_LIST_CATALOG:
         case ACTION_DUMP_CATALOG:
         case ACTION_UPDATE_CATALOG: {
-                _cleanup_free_ char *database;
+                _cleanup_free_ char *database = NULL;
 
                 database = path_join(arg_root, CATALOG_DATABASE);
                 if (!database) {
@@ -2436,7 +2436,7 @@ int main(int argc, char *argv[]) {
                 goto finish;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *filter;
+                _cleanup_free_ char *filter = NULL;
 
                 filter = journal_make_match_string(j);
                 if (!filter)
index 7bc26097f3a2a20b84b7e1a6bae2b02ffca3fe80..385dc4b58faf3910d46474b8cd1309ceeca1e518 100644 (file)
@@ -189,7 +189,7 @@ static int stdout_stream_save(StdoutStream *s) {
                 s->id_field + STRLEN("_STREAM_ID="));
 
         if (!isempty(s->identifier)) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(s->identifier);
                 if (!escaped) {
@@ -201,7 +201,7 @@ static int stdout_stream_save(StdoutStream *s) {
         }
 
         if (!isempty(s->unit_id)) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(s->unit_id);
                 if (!escaped) {
index acb8d9b98ca0d5eeabced8f0f233b765b5edf4d5..7ebe01286da57a97e189e1225805c0ee4bfbbe33 100644 (file)
@@ -23,7 +23,7 @@ int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) {
 }
 
 static void fuzz_client(const uint8_t *data, size_t size, bool is_information_request_enabled) {
-        _cleanup_(sd_event_unrefp) sd_event *e;
+        _cleanup_(sd_event_unrefp) sd_event *e = NULL;
         _cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL;
         struct in6_addr address = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } };
 
index c1736641462d6bcf451db992878ad346a73a82fc..0f1c9eb8f73b19dfb5e7f3690bdbcec9f48d4963 100644 (file)
@@ -88,7 +88,7 @@ static void patch_realtime(
 }
 
 static int journal_file_empty(int dir_fd, const char *name) {
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
         struct stat st;
         le64_t n_entries;
         ssize_t n;
index be92f803c95fd33d641b161b93f995ff0e6c0efd..c90b4c926e6d9abd5ecf627c7023739efcc519ee 100644 (file)
@@ -1860,7 +1860,7 @@ static int add_current_paths(sd_journal *j) {
          * treat them as fatal. */
 
         ORDERED_HASHMAP_FOREACH(f, j->files) {
-                _cleanup_free_ char *dir;
+                _cleanup_free_ char *dir = NULL;
                 int r;
 
                 dir = dirname_malloc(f->path);
index a3da2e3f24dbc43e129b09e3ce7bb383231e754e..b4e010e74c2844bc6be83a82cca0b2eb46df0fdc 100644 (file)
@@ -775,7 +775,7 @@ _public_ int sd_get_sessions(char ***sessions) {
 }
 
 _public_ int sd_get_uids(uid_t **users) {
-        _cleanup_closedir_ DIR *d;
+        _cleanup_closedir_ DIR *d = NULL;
         struct dirent *de;
         int r = 0;
         unsigned n = 0;
index e8de1b789a0e3f90a864a1786bc9249089bb659e..d2f0566dbc5214cc709c0b01dd7688d449c17b9a 100644 (file)
@@ -535,7 +535,7 @@ int vconsole_convert_to_x11(Context *c) {
 
 int find_converted_keymap(const char *x11_layout, const char *x11_variant, char **new_keymap) {
         const char *dir;
-        _cleanup_free_ char *n;
+        _cleanup_free_ char *n = NULL;
 
         if (x11_variant)
                 n = strjoin(x11_layout, "-", x11_variant);
index 953cf6a0d7b4128b4b1c85cd026867c62a16e0a1..df0eb030d46651339fc35c11c0b61949b29e187e 100644 (file)
@@ -457,7 +457,7 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er
         (void) locale_update_system_manager(c, sd_bus_message_get_bus(m));
 
         if (settings) {
-                _cleanup_free_ char *line;
+                _cleanup_free_ char *line = NULL;
 
                 line = strv_join(settings, ", ");
                 log_info("Changed locale to %s.", strnull(line));
index 2ecf2120fdbe5105affac2631e7e4e1c54b1f6ab..cd3a37420123fae987893da4543dcf6c47dfc73e 100644 (file)
@@ -485,7 +485,7 @@ int config_parse_n_autovts(
 static int vt_is_busy(unsigned vtnr) {
         struct vt_stat vt_stat;
         int r;
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
 
         assert(vtnr >= 1);
 
index 694a99fba14c76f721ddc3a080ab3252abecb139..feeacc2d9971ba54ad3811b80a5125bd8b2cbf16 100644 (file)
@@ -1371,7 +1371,7 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
 }
 
 static int flush_devices(Manager *m) {
-        _cleanup_closedir_ DIR *d;
+        _cleanup_closedir_ DIR *d = NULL;
 
         assert(m);
 
@@ -2073,7 +2073,7 @@ static int update_schedule_file(Manager *m) {
                 m->scheduled_shutdown_type);
 
         if (!isempty(m->wall_message)) {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = cescape(m->wall_message);
                 if (!t) {
index 34fcde92aae10b1fdb66e5d1c17376ce5cf1882a..6a3dd860db4e9de5de10b695e8d820ec6716c8b3 100644 (file)
@@ -266,7 +266,7 @@ int session_save(Session *s) {
                 fprintf(f, "DISPLAY=%s\n", s->display);
 
         if (s->remote_host) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(s->remote_host);
                 if (!escaped) {
@@ -278,7 +278,7 @@ int session_save(Session *s) {
         }
 
         if (s->remote_user) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(s->remote_user);
                 if (!escaped) {
@@ -290,7 +290,7 @@ int session_save(Session *s) {
         }
 
         if (s->service) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(s->service);
                 if (!escaped) {
@@ -302,7 +302,7 @@ int session_save(Session *s) {
         }
 
         if (s->desktop) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(s->desktop);
                 if (!escaped) {
index 537b0cd77939ad466cb079370e6f12bcfc75e50f..6215b29c2768d54f51d48f3c47a23af7724a122b 100644 (file)
@@ -134,7 +134,7 @@ int machine_save(Machine *m) {
                 m->name);
 
         if (m->unit) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(m->unit);
                 if (!escaped) {
@@ -149,7 +149,7 @@ int machine_save(Machine *m) {
                 fprintf(f, "SCOPE_JOB=%s\n", m->scope_job);
 
         if (m->service) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(m->service);
                 if (!escaped) {
@@ -160,7 +160,7 @@ int machine_save(Machine *m) {
         }
 
         if (m->root_directory) {
-                _cleanup_free_ char *escaped;
+                _cleanup_free_ char *escaped = NULL;
 
                 escaped = cescape(m->root_directory);
                 if (!escaped) {
index d9d654495e0de99d361fd21b3a00345e68b9ee96..0e13c4f88ada59be97e579314d0625e82b99ce1b 100644 (file)
@@ -46,7 +46,7 @@ static int netdev_fill_tuntap_message(NetDev *netdev, struct ifreq *ifr) {
 }
 
 static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
-        _cleanup_close_ int fd;
+        _cleanup_close_ int fd = -1;
         TunTap *t = NULL;
         const char *user;
         const char *group;
index ca0116e7f307278908d062f944b8bfb7ae106e9f..98480a6c65ab4cf1f1981b58dbd14fcb4a39c515 100644 (file)
@@ -53,7 +53,7 @@ static int help(void) {
 
 static int parse_interface_with_operstate_range(const char *str) {
         _cleanup_free_ char *ifname = NULL;
-        _cleanup_free_ LinkOperationalStateRange *range;
+        _cleanup_free_ LinkOperationalStateRange *range = NULL;
         const char *p;
         int r;
 
index 02d1d641950d15ad1a44aa8446b3a03805ea4e72..e2bce279473c26a42d94db36b16f672156b44ab2 100644 (file)
@@ -861,7 +861,7 @@ static int find_profile(const char *name, const char *unit, char **ret) {
         assert_se(dot = strrchr(unit, '.'));
 
         NULSTR_FOREACH(p, profile_dirs) {
-                _cleanup_free_ char *joined;
+                _cleanup_free_ char *joined = NULL;
 
                 joined = strjoin(p, "/", name, "/", dot + 1, ".conf");
                 if (!joined)
index fa6df9054ae697faaba34de12864e6993650cc4f..2d8079ad97992ef795d688351aa0938bb8a45db9 100644 (file)
@@ -341,7 +341,7 @@ static int inspect_image(int argc, char *argv[], void *userdata) {
                 nl = true;
         } else {
                 _cleanup_free_ char *pretty_portable = NULL, *pretty_os = NULL;
-                _cleanup_fclose_ FILE *f;
+                _cleanup_fclose_ FILE *f = NULL;
 
                 f = fmemopen_unlocked((void*) data, sz, "re");
                 if (!f)
index 81c62bdca6b6213009004f96e69504859801da6f..e155df0efa10af12b2e86057b5779ab3cc14d5c3 100644 (file)
@@ -1447,7 +1447,7 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) {
 
         /* Since all the active services are in the zone make them discoverable now. */
         SET_FOREACH(service_type, types) {
-                _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr;
+                _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
 
                 rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_PTR,
                                                   "_services._dns-sd._udp.local");
index ef4b88361f29bf14d62f85dee9e4c583670d2aae..10e1857649403a0380b33b8a97d2b83958c6a7f8 100644 (file)
@@ -211,7 +211,7 @@ int acl_search_groups(const char *path, char ***ret_groups) {
 
 int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask) {
         _cleanup_free_ char **a = NULL, **d = NULL; /* strings are not freed */
-        _cleanup_strv_free_ char **split;
+        _cleanup_strv_free_ char **split = NULL;
         char **entry;
         int r = -EINVAL;
         _cleanup_(acl_freep) acl_t a_acl = NULL, d_acl = NULL;
@@ -233,7 +233,7 @@ int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want
         }
 
         if (!strv_isempty(a)) {
-                _cleanup_free_ char *join;
+                _cleanup_free_ char *join = NULL;
 
                 join = strv_join(a, ",");
                 if (!join)
@@ -251,7 +251,7 @@ int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want
         }
 
         if (!strv_isempty(d)) {
-                _cleanup_free_ char *join;
+                _cleanup_free_ char *join = NULL;
 
                 join = strv_join(d, ",");
                 if (!join)
index 51b71ecc2c18a6758ac2b956896d4c109c2d0a91..e66c8beafab8124d3237477d26aae45efeb39811 100644 (file)
@@ -184,7 +184,7 @@ static void log_job_error_with_service_result(const char* service, const char *r
         service_shell_quoted = shell_maybe_quote(service, ESCAPE_BACKSLASH);
 
         if (!strv_isempty((char**) extra_args)) {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = strv_join((char**) extra_args, " ");
                 systemctl = strjoina("systemctl ", t ? : "<args>");
index 77fe227e36f8d5f0e625331bc39792dedd73e60d..497b0884d49f63ae8a7ac1a77d214ef044e13c33 100644 (file)
@@ -240,7 +240,7 @@ static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gi
                 }
 
                 if (S_ISDIR(st.st_mode)) {
-                        _cleanup_closedir_ DIR *kid;
+                        _cleanup_closedir_ DIR *kid = NULL;
 
                         kid = xopendirat(dirfd(dir), de->d_name, O_NOFOLLOW|O_NOATIME);
                         if (!kid) {
index ec67b054b4e7ad72b138f92666ebd697ab383015..b446daf5819731c02af0432fce2ac58b22a13e17 100644 (file)
@@ -55,7 +55,7 @@ int clock_set_hwclock(const struct tm *tm) {
 }
 
 int clock_is_localtime(const char* adjtime_path) {
-        _cleanup_fclose_ FILE *f;
+        _cleanup_fclose_ FILE *f = NULL;
         int r;
 
         if (!adjtime_path)
index abc4bb36516c45f87b02eca5484442642e33dfbb..76cf3343db78a1e88480c569eade2a13415bcf1c 100644 (file)
@@ -1409,7 +1409,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         case TABLE_TIMESTAMP:
         case TABLE_TIMESTAMP_UTC:
         case TABLE_TIMESTAMP_RELATIVE: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
                 char *ret;
 
                 p = new(char, FORMAT_TIMESTAMP_MAX);
@@ -1431,7 +1431,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
 
         case TABLE_TIMESPAN:
         case TABLE_TIMESPAN_MSEC: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, FORMAT_TIMESPAN_MAX);
                 if (!p)
@@ -1446,7 +1446,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_SIZE: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, FORMAT_BYTES_MAX);
                 if (!p)
@@ -1460,7 +1460,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_BPS: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
                 size_t n;
 
                 p = new(char, FORMAT_BYTES_MAX+2);
@@ -1478,7 +1478,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_INT: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->int_val) + 1);
                 if (!p)
@@ -1490,7 +1490,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_INT8: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->int8) + 1);
                 if (!p)
@@ -1502,7 +1502,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_INT16: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->int16) + 1);
                 if (!p)
@@ -1514,7 +1514,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_INT32: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->int32) + 1);
                 if (!p)
@@ -1526,7 +1526,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_INT64: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->int64) + 1);
                 if (!p)
@@ -1538,7 +1538,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_UINT: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->uint_val) + 1);
                 if (!p)
@@ -1550,7 +1550,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_UINT8: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->uint8) + 1);
                 if (!p)
@@ -1562,7 +1562,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_UINT16: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->uint16) + 1);
                 if (!p)
@@ -1574,7 +1574,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_UINT32: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->uint32) + 1);
                 if (!p)
@@ -1586,7 +1586,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_UINT64: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->uint64) + 1);
                 if (!p)
@@ -1598,7 +1598,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
         }
 
         case TABLE_PERCENT: {
-                _cleanup_free_ char *p;
+                _cleanup_free_ char *p = NULL;
 
                 p = new(char, DECIMAL_STR_WIDTH(d->percent) + 2);
                 if (!p)
index c6cea43126f866a8aac41862f1eced06e27caf46..eb8d7c1c45193a594988556aff753e4456566eb0 100644 (file)
@@ -2950,7 +2950,7 @@ static int read_presets(UnitFileScope scope, const char *root_dir, UnitFilePrese
                 return r;
 
         STRV_FOREACH(p, files) {
-                _cleanup_fclose_ FILE *f;
+                _cleanup_fclose_ FILE *f = NULL;
                 int n = 0;
 
                 f = fopen(*p, "re");
index 706a00c7f0612d6e087f265e965c2d2908a3aceb..e63c59bd94e324b686a42b1d6986a941ac0c677f 100644 (file)
@@ -294,7 +294,7 @@ static bool print_multiline(
                                         continuation * prefix, "",
                                         color_on, len, pos, color_off);
                         else {
-                                _cleanup_free_ char *e;
+                                _cleanup_free_ char *e = NULL;
 
                                 e = ellipsize_mem(pos, len, n_columns - prefix,
                                                   tail_line ? 100 : 90);
@@ -1651,7 +1651,7 @@ int show_journal_by_unit(
                 return r;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *filter;
+                _cleanup_free_ char *filter = NULL;
 
                 filter = journal_make_match_string(j);
                 if (!filter)
index 174bb2a7ea0a866bceb6d4ba57fcc8ac27b6fbfd..2479a5672c5ed1bcb0965165452d5b7bc7c19f04 100644 (file)
@@ -147,7 +147,7 @@ bool net_match_config(
                 const char *ssid,
                 const struct ether_addr *bssid) {
 
-        _cleanup_free_ char *iftype_str;
+        _cleanup_free_ char *iftype_str = NULL;
         const char *path = NULL;
 
         assert(match);
index 37f83306dba87f8794040f1f408709e93b200869..53280cf40a2e1df81840d9961daaf245e581315b 100644 (file)
@@ -34,7 +34,7 @@
 #include "time-util.h"
 
 int parse_sleep_config(SleepConfig **ret_sleep_config) {
-        _cleanup_(free_sleep_configp) SleepConfig *sc;
+        _cleanup_(free_sleep_configp) SleepConfig *sc = NULL;
         int allow_suspend = -1, allow_hibernate = -1,
             allow_s2h = -1, allow_hybrid_sleep = -1;
 
index 314962ac69fb87af3e60d625c13407f4dae5408a..6e7c67ef2f27b54fe82a5b755e56bc8db5d5d934 100644 (file)
@@ -576,7 +576,7 @@ end:
 
                 /* Removing empty dropin dirs */
                 if (!arg_full) {
-                        _cleanup_free_ char *dir;
+                        _cleanup_free_ char *dir = NULL;
 
                         dir = dirname_malloc(*original);
                         if (!dir)
index e02a7608feef5d0a18a1d3c07fb6fab689058b73..135d8388a3ffd1b152f9a1890974d543b9922fe4 100644 (file)
@@ -24,7 +24,7 @@ static int get_unit_list_recursive(
                 char ***ret_machines) {
 
         _cleanup_free_ UnitInfo *unit_infos = NULL;
-        _cleanup_(message_set_freep) Set *replies;
+        _cleanup_(message_set_freep) Set *replies = NULL;
         sd_bus_message *reply;
         int c, r;
 
index 2fe3d8c509e2b994ed8e2bf69b7055e31849586e..1a0bd35617da14f80004b7c02cb1b86fdc799dff 100644 (file)
@@ -1282,7 +1282,7 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
                         while ((r = exec_status_info_deserialize(m, &info, is_ex_prop)) > 0) {
                                 char timestamp1[FORMAT_TIMESTAMP_MAX], timestamp2[FORMAT_TIMESTAMP_MAX];
                                 _cleanup_strv_free_ char **optv = NULL;
-                                _cleanup_free_ char *tt, *o = NULL;
+                                _cleanup_free_ char *tt = NULL, *o = NULL;
 
                                 tt = strv_join(info.argv, " ");
 
@@ -2129,7 +2129,7 @@ int show(int argc, char *argv[], void *userdata) {
                                 return r;
 
                         STRV_FOREACH(name, names) {
-                                _cleanup_free_ char *path;
+                                _cleanup_free_ char *path = NULL;
 
                                 path = unit_dbus_path_from_name(*name);
                                 if (!path)
index 8c7aef23c33c640dad1cfc12c13372e1116b13f7..cef141fbacbcb7912c98496bb324aedaae1c9265 100644 (file)
@@ -137,7 +137,7 @@ static int generate_unit_file(SysvStub *s) {
                 path_escaped);
 
         if (s->description) {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = specifier_escape(s->description);
                 if (!t)
@@ -165,7 +165,7 @@ static int generate_unit_file(SysvStub *s) {
                 yes_no(!s->pid_file));
 
         if (s->pid_file) {
-                _cleanup_free_ char *t;
+                _cleanup_free_ char *t = NULL;
 
                 t = specifier_escape(s->pid_file);
                 if (!t)
@@ -419,7 +419,7 @@ static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text
 }
 
 static int load_sysv(SysvStub *s) {
-        _cleanup_fclose_ FILE *f;
+        _cleanup_fclose_ FILE *f = NULL;
         unsigned line = 0;
         int r;
         enum {
index df34541bf702ce6bf45912cab726afd251cfb0e3..2a9b113ff484128840d6b090666826b3a8926ea3 100644 (file)
@@ -179,7 +179,7 @@ static int clock_state_update(
 }
 
 static int run(int argc, char * argv[]) {
-        _cleanup_(sd_event_unrefp) sd_event *event;
+        _cleanup_(sd_event_unrefp) sd_event *event = NULL;
         _cleanup_(clock_state_release) ClockState state = {
                 .timerfd_fd = -1,
                 .inotify_fd = -1,
index 5ee82c708b709ab36f93579b3fce3d86729ede10..ceacb61bf14b92365ef13a216db92e9414da3277 100644 (file)
@@ -289,7 +289,7 @@ static int wall_tty_block(void) {
 }
 
 static int process_password_files(void) {
-        _cleanup_closedir_ DIR *d;
+        _cleanup_closedir_ DIR *d = NULL;
         struct dirent *de;
         int r = 0;
 
index 2f07a2d99fa4a19e109300b548fc6751206b6ccf..d9d897c00cae4517ad2650491c140051b49e3077 100644 (file)
@@ -106,7 +106,7 @@ static int get_file_options(const char *vendor, const char *model,
                             int *argc, char ***newargv) {
         _cleanup_free_ char *vendor_in = NULL, *model_in = NULL, *options_in = NULL; /* read in from file */
         _cleanup_strv_free_ char **options_argv = NULL;
-        _cleanup_fclose_ FILE *f;
+        _cleanup_fclose_ FILE *f = NULL;
         int lineno, r;
 
         f = fopen(config_file, "re");
index 45915ef853bfb54a5f090c070f6d224823132229..d1c3febdd5bb95ac91d0b9ac28b4cb72d296266e 100644 (file)
@@ -146,7 +146,7 @@ static int keyboard_load_and_wait(const char *vc, const char *map, const char *m
         args[i++] = NULL;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *cmd;
+                _cleanup_free_ char *cmd = NULL;
 
                 cmd = strv_join((char**) args, " ");
                 log_debug("Executing \"%s\"...", strnull(cmd));
@@ -189,7 +189,7 @@ static int font_load_and_wait(const char *vc, const char *font, const char *map,
         args[i++] = NULL;
 
         if (DEBUG_LOGGING) {
-                _cleanup_free_ char *cmd;
+                _cleanup_free_ char *cmd = NULL;
 
                 cmd = strv_join((char**) args, " ");
                 log_debug("Executing \"%s\"...", strnull(cmd));