ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
803fb7
From c815acfb5863d9562a3f1e9cbd6204da3364860c Mon Sep 17 00:00:00 2001
803fb7
From: Harald Hoyer <harald@redhat.com>
803fb7
Date: Fri, 27 Mar 2015 12:02:49 +0100
803fb7
Subject: [PATCH] fix gcc warnings about uninitialized variables
803fb7
MIME-Version: 1.0
803fb7
Content-Type: text/plain; charset=UTF-8
803fb7
Content-Transfer-Encoding: 8bit
803fb7
803fb7
like:
803fb7
803fb7
src/shared/install.c: In function ‘unit_file_lookup_state’:
803fb7
src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in
803fb7
this function [-Wmaybe-uninitialized]
803fb7
         return r < 0 ? r : state;
803fb7
                ^
803fb7
src/shared/install.c:1796:13: note: ‘r’ was declared here
803fb7
         int r;
803fb7
             ^
803fb7
803fb7
Conflicts:
803fb7
	src/journal/journal-file.c
803fb7
	src/shared/btrfs-util.c
803fb7
        src/shared/install.c
803fb7
803fb7
Cherry-picked from: a7f7d1bde43fc825c49afea3f946f5b4b3d563e0
803fb7
Related: #1318994
803fb7
---
803fb7
 src/import/import-job.c                   | 2 +-
803fb7
 src/journal-remote/journal-gatewayd.c     | 2 +-
803fb7
 src/journal-remote/journal-remote-parse.c | 2 +-
803fb7
 src/journal-remote/journal-remote.c       | 4 ++--
803fb7
 src/journal/catalog.c                     | 2 +-
803fb7
 src/journal/coredump.c                    | 4 ++--
803fb7
 src/journal/journal-file.c                | 6 +++---
803fb7
 src/journal/journal-vacuum.c              | 2 +-
803fb7
 src/journal/journalctl.c                  | 2 +-
803fb7
 src/journal/test-journal-stream.c         | 2 +-
803fb7
 src/libsystemd-network/lldp-tlv.c         | 8 ++++----
803fb7
 src/libsystemd-network/sd-dhcp-server.c   | 2 +-
803fb7
 src/libsystemd-network/sd-pppoe.c         | 2 +-
803fb7
 src/libsystemd/sd-login/sd-login.c        | 2 +-
803fb7
 src/network/networkctl.c                  | 2 +-
803fb7
 src/resolve/resolved-dns-transaction.c    | 2 +-
803fb7
 src/resolve/test-dns-domain.c             | 2 +-
803fb7
 src/shared/base-filesystem.c              | 2 +-
803fb7
 src/shared/capability.c                   | 2 +-
803fb7
 src/shared/copy.c                         | 6 +++---
803fb7
 src/shared/install.c                      | 2 +-
803fb7
 src/shared/logs-show.c                    | 2 +-
803fb7
 src/shared/util.c                         | 4 ++--
803fb7
 src/test/test-path.c                      | 2 +-
803fb7
 src/test/test-pty.c                       | 2 +-
803fb7
 src/udev/net/link-config.c                | 2 +-
803fb7
 26 files changed, 36 insertions(+), 36 deletions(-)
803fb7
803fb7
diff --git a/src/import/import-job.c b/src/import/import-job.c
803fb7
index 5f9cfd366..d826f493f 100644
803fb7
--- a/src/import/import-job.c
803fb7
+++ b/src/import/import-job.c
803fb7
@@ -80,7 +80,7 @@ void import_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) {
803fb7
         long status;
803fb7
         int r;
803fb7
 
803fb7
-        if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, &j) != CURLE_OK)
803fb7
+        if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&j) != CURLE_OK)
803fb7
                 return;
803fb7
 
803fb7
         if (!j || j->state == IMPORT_JOB_DONE || j->state == IMPORT_JOB_FAILED)
803fb7
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
803fb7
index 576f7cae7..d1f0ce3da 100644
803fb7
--- a/src/journal-remote/journal-gatewayd.c
803fb7
+++ b/src/journal-remote/journal-gatewayd.c
803fb7
@@ -736,7 +736,7 @@ static int request_handler_machine(
803fb7
         RequestMeta *m = connection_cls;
803fb7
         int r;
803fb7
         _cleanup_free_ char* hostname = NULL, *os_name = NULL;
803fb7
-        uint64_t cutoff_from = 0, cutoff_to = 0, usage;
803fb7
+        uint64_t cutoff_from = 0, cutoff_to = 0, usage = 0;
803fb7
         char *json;
803fb7
         sd_id128_t mid, bid;
803fb7
         _cleanup_free_ char *v = NULL;
803fb7
diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c
803fb7
index 7e6295435..64089da19 100644
803fb7
--- a/src/journal-remote/journal-remote-parse.c
803fb7
+++ b/src/journal-remote/journal-remote-parse.c
803fb7
@@ -316,7 +316,7 @@ int process_data(RemoteSource *source) {
803fb7
         switch(source->state) {
803fb7
         case STATE_LINE: {
803fb7
                 char *line, *sep;
803fb7
-                size_t n;
803fb7
+                size_t n = 0;
803fb7
 
803fb7
                 assert(source->data_size == 0);
803fb7
 
803fb7
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
803fb7
index 9c515f9c8..4fac55cc9 100644
803fb7
--- a/src/journal-remote/journal-remote.c
803fb7
+++ b/src/journal-remote/journal-remote.c
803fb7
@@ -353,7 +353,7 @@ static int remove_source(RemoteServer *s, int fd) {
803fb7
 
803fb7
 static int add_source(RemoteServer *s, int fd, char* name, bool own_name) {
803fb7
 
803fb7
-        RemoteSource *source;
803fb7
+        RemoteSource *source = NULL;
803fb7
         int r;
803fb7
 
803fb7
         /* This takes ownership of name, even on failure, if own_name is true. */
803fb7
@@ -1148,7 +1148,7 @@ static int dispatch_raw_connection_event(sd_event_source *event,
803fb7
                 .size = sizeof(union sockaddr_union),
803fb7
                 .type = SOCK_STREAM,
803fb7
         };
803fb7
-        char *hostname;
803fb7
+        char *hostname = NULL;
803fb7
 
803fb7
         fd2 = accept_connection("raw", fd, &addr, &hostname);
803fb7
         if (fd2 < 0)
803fb7
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
803fb7
index f17023284..a9c40c6d4 100644
803fb7
--- a/src/journal/catalog.c
803fb7
+++ b/src/journal/catalog.c
803fb7
@@ -559,7 +559,7 @@ static const char *find_id(void *p, sd_id128_t id) {
803fb7
 int catalog_get(const char* database, sd_id128_t id, char **_text) {
803fb7
         _cleanup_close_ int fd = -1;
803fb7
         void *p = NULL;
803fb7
-        struct stat st;
803fb7
+        struct stat st = {};
803fb7
         char *text = NULL;
803fb7
         int r;
803fb7
         const char *s;
803fb7
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
803fb7
index f7ba0191e..59ccd46bb 100644
803fb7
--- a/src/journal/coredump.c
803fb7
+++ b/src/journal/coredump.c
803fb7
@@ -244,7 +244,7 @@ static int maybe_remove_external_coredump(const char *filename, off_t size) {
803fb7
 
803fb7
 static int make_filename(const char *info[_INFO_LEN], char **ret) {
803fb7
         _cleanup_free_ char *c = NULL, *u = NULL, *p = NULL, *t = NULL;
803fb7
-        sd_id128_t boot;
803fb7
+        sd_id128_t boot = {};
803fb7
         int r;
803fb7
 
803fb7
         assert(info);
803fb7
@@ -843,7 +843,7 @@ log:
803fb7
         /* Optionally store the entire coredump in the journal */
803fb7
         if (IN_SET(arg_storage, COREDUMP_STORAGE_JOURNAL, COREDUMP_STORAGE_BOTH) &&
803fb7
             coredump_size <= (off_t) arg_journal_size_max) {
803fb7
-                size_t sz;
803fb7
+                size_t sz = 0;
803fb7
 
803fb7
                 /* Store the coredump itself in the journal */
803fb7
 
803fb7
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
803fb7
index ef1849787..2a93460d4 100644
803fb7
--- a/src/journal/journal-file.c
803fb7
+++ b/src/journal/journal-file.c
803fb7
@@ -911,7 +911,7 @@ int journal_file_find_data_object_with_hash(
803fb7
                 if (o->object.flags & OBJECT_COMPRESSION_MASK) {
803fb7
 #if defined(HAVE_XZ) || defined(HAVE_LZ4)
803fb7
                         uint64_t l;
803fb7
-                        size_t rsize;
803fb7
+                        size_t rsize = 0;
803fb7
 
803fb7
                         l = le64toh(o->object.size);
803fb7
                         if (l <= offsetof(Object, data.payload))
803fb7
@@ -1075,7 +1075,7 @@ static int journal_file_append_data(
803fb7
 
803fb7
 #if defined(HAVE_XZ) || defined(HAVE_LZ4)
803fb7
         if (JOURNAL_FILE_COMPRESS(f) && size >= COMPRESSION_SIZE_THRESHOLD) {
803fb7
-                size_t rsize;
803fb7
+                size_t rsize = 0;
803fb7
 
803fb7
                 compression = compress_blob(data, size, o->data.payload, &rsize);
803fb7
 
803fb7
@@ -2903,7 +2903,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
803fb7
 
803fb7
                 if (o->object.flags & OBJECT_COMPRESSION_MASK) {
803fb7
 #if defined(HAVE_XZ) || defined(HAVE_LZ4)
803fb7
-                        size_t rsize;
803fb7
+                        size_t rsize = 0;
803fb7
 
803fb7
                         r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK,
803fb7
                                             o->data.payload, l, &from->compress_buffer, &from->compress_buffer_size, &rsize, 0);
803fb7
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
803fb7
index 832c327b3..856d11e4e 100644
803fb7
--- a/src/journal/journal-vacuum.c
803fb7
+++ b/src/journal/journal-vacuum.c
803fb7
@@ -76,7 +76,7 @@ static void patch_realtime(
803fb7
                 unsigned long long *realtime) {
803fb7
 
803fb7
         _cleanup_free_ const char *path = NULL;
803fb7
-        usec_t x, crtime;
803fb7
+        usec_t x, crtime = 0;
803fb7
 
803fb7
         /* The timestamp was determined by the file name, but let's
803fb7
          * see if the file might actually be older than the file name
803fb7
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
803fb7
index a38ce4b8f..6ba884779 100644
803fb7
--- a/src/journal/journalctl.c
803fb7
+++ b/src/journal/journalctl.c
803fb7
@@ -1644,7 +1644,7 @@ static int verify(sd_journal *j) {
803fb7
 
803fb7
         ORDERED_HASHMAP_FOREACH(f, j->files, i) {
803fb7
                 int k;
803fb7
-                usec_t first, validated, last;
803fb7
+                usec_t first = 0, validated = 0, last = 0;
803fb7
 
803fb7
 #ifdef HAVE_GCRYPT
803fb7
                 if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header))
803fb7
diff --git a/src/journal/test-journal-stream.c b/src/journal/test-journal-stream.c
803fb7
index 3996e778e..b8caeb3d4 100644
803fb7
--- a/src/journal/test-journal-stream.c
803fb7
+++ b/src/journal/test-journal-stream.c
803fb7
@@ -42,7 +42,7 @@ static void verify_contents(sd_journal *j, unsigned skip) {
803fb7
                 const void *d;
803fb7
                 char *k, *c;
803fb7
                 size_t l;
803fb7
-                unsigned u;
803fb7
+                unsigned u = 0;
803fb7
 
803fb7
                 assert_se(sd_journal_get_cursor(j, &k) >= 0);
803fb7
                 printf("cursor: %s\n", k);
803fb7
diff --git a/src/libsystemd-network/lldp-tlv.c b/src/libsystemd-network/lldp-tlv.c
803fb7
index e43d70d3c..e32783f3e 100644
803fb7
--- a/src/libsystemd-network/lldp-tlv.c
803fb7
+++ b/src/libsystemd-network/lldp-tlv.c
803fb7
@@ -156,7 +156,7 @@ static inline int tlv_packet_read_internal(tlv_section *m, void **data) {
803fb7
 }
803fb7
 
803fb7
 int tlv_packet_read_u8(tlv_packet *m, uint8_t *data) {
803fb7
-        void *val;
803fb7
+        void *val = NULL;
803fb7
         int r;
803fb7
 
803fb7
         assert_return(m, -EINVAL);
803fb7
@@ -174,7 +174,7 @@ int tlv_packet_read_u8(tlv_packet *m, uint8_t *data) {
803fb7
 
803fb7
 int tlv_packet_read_u16(tlv_packet *m, uint16_t *data) {
803fb7
         uint16_t t;
803fb7
-        void *val;
803fb7
+        void *val = NULL;
803fb7
         int r;
803fb7
 
803fb7
         assert_return(m, -EINVAL);
803fb7
@@ -211,7 +211,7 @@ int tlv_packet_read_u32(tlv_packet *m, uint32_t *data) {
803fb7
 }
803fb7
 
803fb7
 int tlv_packet_read_string(tlv_packet *m, char **data, uint16_t *data_length) {
803fb7
-        void *val;
803fb7
+        void *val = NULL;
803fb7
         int r;
803fb7
 
803fb7
         assert_return(m, -EINVAL);
803fb7
@@ -229,7 +229,7 @@ int tlv_packet_read_string(tlv_packet *m, char **data, uint16_t *data_length) {
803fb7
 }
803fb7
 
803fb7
 int tlv_packet_read_bytes(tlv_packet *m, uint8_t **data, uint16_t *data_length) {
803fb7
-        void *val;
803fb7
+        void *val = NULL;
803fb7
         int r;
803fb7
 
803fb7
         assert_return(m, -EINVAL);
803fb7
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
803fb7
index 3f89f344d..0f284eb6a 100644
803fb7
--- a/src/libsystemd-network/sd-dhcp-server.c
803fb7
+++ b/src/libsystemd-network/sd-dhcp-server.c
803fb7
@@ -776,7 +776,7 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
803fb7
                 if (pool_offset >= 0 &&
803fb7
                     server->bound_leases[pool_offset] == existing_lease) {
803fb7
                         DHCPLease *lease;
803fb7
-                        usec_t time_now;
803fb7
+                        usec_t time_now = 0;
803fb7
 
803fb7
                         if (!existing_lease) {
803fb7
                                 lease = new0(DHCPLease, 1);
803fb7
diff --git a/src/libsystemd-network/sd-pppoe.c b/src/libsystemd-network/sd-pppoe.c
803fb7
index 4f49b799e..83e58a3db 100644
803fb7
--- a/src/libsystemd-network/sd-pppoe.c
803fb7
+++ b/src/libsystemd-network/sd-pppoe.c
803fb7
@@ -340,7 +340,7 @@ static int pppoe_timeout(sd_event_source *s, uint64_t usec, void *userdata);
803fb7
 
803fb7
 static int pppoe_arm_timeout(sd_pppoe *ppp) {
803fb7
         _cleanup_event_source_unref_ sd_event_source *timeout = NULL;
803fb7
-        usec_t next_timeout;
803fb7
+        usec_t next_timeout = 0;
803fb7
         int r;
803fb7
 
803fb7
         assert(ppp);
803fb7
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
803fb7
index f71749f72..cc0677bdf 100644
803fb7
--- a/src/libsystemd/sd-login/sd-login.c
803fb7
+++ b/src/libsystemd/sd-login/sd-login.c
803fb7
@@ -82,7 +82,7 @@ _public_ int sd_pid_get_owner_uid(pid_t pid, uid_t *uid) {
803fb7
 }
803fb7
 
803fb7
 _public_ int sd_peer_get_session(int fd, char **session) {
803fb7
-        struct ucred ucred;
803fb7
+        struct ucred ucred = {};
803fb7
         int r;
803fb7
 
803fb7
         assert_return(fd >= 0, -EINVAL);
803fb7
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
803fb7
index aa83f32f5..778670b73 100644
803fb7
--- a/src/network/networkctl.c
803fb7
+++ b/src/network/networkctl.c
803fb7
@@ -964,7 +964,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
803fb7
                                                 return -ENOMEM;
803fb7
 
803fb7
                                 } else if (streq(a, "_TTL")) {
803fb7
-                                        long long unsigned x;
803fb7
+                                        long long unsigned x = 0;
803fb7
                                         usec_t time;
803fb7
 
803fb7
                                         r = safe_atollu(b, &x);
803fb7
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c
803fb7
index 74b063414..bc1a90db1 100644
803fb7
--- a/src/resolve/resolved-dns-transaction.c
803fb7
+++ b/src/resolve/resolved-dns-transaction.c
803fb7
@@ -252,7 +252,7 @@ static int dns_transaction_open_tcp(DnsTransaction *t) {
803fb7
                         fd = dns_scope_tcp_socket(t->scope, t->received->family, &t->received->sender, t->received->sender_port);
803fb7
                 else {
803fb7
                         union in_addr_union address;
803fb7
-                        int family;
803fb7
+                        int family = AF_UNSPEC;
803fb7
 
803fb7
                         /* Otherwise, try to talk to the owner of a
803fb7
                          * the IP address, in case this is a reverse
803fb7
diff --git a/src/resolve/test-dns-domain.c b/src/resolve/test-dns-domain.c
803fb7
index ebc8d98fc..4963a9c6a 100644
803fb7
--- a/src/resolve/test-dns-domain.c
803fb7
+++ b/src/resolve/test-dns-domain.c
803fb7
@@ -162,7 +162,7 @@ static void test_dns_name_single_label(void) {
803fb7
 
803fb7
 static void test_dns_name_reverse_one(const char *address, const char *name) {
803fb7
         _cleanup_free_ char *p = NULL;
803fb7
-        union in_addr_union a, b;
803fb7
+        union in_addr_union a, b = {};
803fb7
         int familya, familyb;
803fb7
 
803fb7
         assert_se(in_addr_from_string_auto(address, &familya, &a) >= 0);
803fb7
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
803fb7
index 73907c635..20a69bdbf 100644
803fb7
--- a/src/shared/base-filesystem.c
803fb7
+++ b/src/shared/base-filesystem.c
803fb7
@@ -55,7 +55,7 @@ static const BaseFilesystem table[] = {
803fb7
 int base_filesystem_create(const char *root) {
803fb7
         _cleanup_close_ int fd = -1;
803fb7
         unsigned i;
803fb7
-        int r;
803fb7
+        int r = 0;
803fb7
 
803fb7
         fd = open(root, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
803fb7
         if (fd < 0)
803fb7
diff --git a/src/shared/capability.c b/src/shared/capability.c
803fb7
index 915ceb9d9..2b963fde3 100644
803fb7
--- a/src/shared/capability.c
803fb7
+++ b/src/shared/capability.c
803fb7
@@ -55,7 +55,7 @@ unsigned long cap_last_cap(void) {
803fb7
         static thread_local unsigned long saved;
803fb7
         static thread_local bool valid = false;
803fb7
         _cleanup_free_ char *content = NULL;
803fb7
-        unsigned long p;
803fb7
+        unsigned long p = 0;
803fb7
         int r;
803fb7
 
803fb7
         if (valid)
803fb7
diff --git a/src/shared/copy.c b/src/shared/copy.c
803fb7
index 0239a5806..2a0cb2808 100644
803fb7
--- a/src/shared/copy.c
803fb7
+++ b/src/shared/copy.c
803fb7
@@ -360,7 +360,7 @@ int copy_file_fd(const char *from, int fdt, bool try_reflink) {
803fb7
 }
803fb7
 
803fb7
 int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned chattr_flags) {
803fb7
-        int fdt, r;
803fb7
+        int fdt = -1, r;
803fb7
 
803fb7
         assert(from);
803fb7
         assert(to);
803fb7
@@ -390,7 +390,7 @@ int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned
803fb7
 }
803fb7
 
803fb7
 int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace, unsigned chattr_flags) {
803fb7
-        _cleanup_free_ char *t;
803fb7
+        _cleanup_free_ char *t = NULL;
803fb7
         int r;
803fb7
 
803fb7
         assert(from);
803fb7
@@ -415,7 +415,7 @@ int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace
803fb7
 int copy_times(int fdf, int fdt) {
803fb7
         struct timespec ut[2];
803fb7
         struct stat st;
803fb7
-        usec_t crtime;
803fb7
+        usec_t crtime = 0;
803fb7
 
803fb7
         assert(fdf >= 0);
803fb7
         assert(fdt >= 0);
803fb7
diff --git a/src/shared/install.c b/src/shared/install.c
803fb7
index 9962508b1..61aaafe7b 100644
803fb7
--- a/src/shared/install.c
803fb7
+++ b/src/shared/install.c
803fb7
@@ -2046,7 +2046,7 @@ UnitFileState unit_file_lookup_state(
803fb7
         _cleanup_(install_context_done) InstallContext c = {};
803fb7
         InstallInfo *i;
803fb7
         UnitFileState state;
803fb7
-        int r;
803fb7
+        int r = 0;
803fb7
 
803fb7
         assert(paths);
803fb7
         assert(name);
803fb7
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
803fb7
index 8c374116a..a572be94b 100644
803fb7
--- a/src/shared/logs-show.c
803fb7
+++ b/src/shared/logs-show.c
803fb7
@@ -993,7 +993,7 @@ static int show_journal(FILE *f,
803fb7
 
803fb7
                 if (warn_cutoff && line < how_many && not_before > 0) {
803fb7
                         sd_id128_t boot_id;
803fb7
-                        usec_t cutoff;
803fb7
+                        usec_t cutoff = 0;
803fb7
 
803fb7
                         /* Check whether the cutoff line is too early */
803fb7
 
803fb7
diff --git a/src/shared/util.c b/src/shared/util.c
803fb7
index 303026152..4c441a544 100644
803fb7
--- a/src/shared/util.c
803fb7
+++ b/src/shared/util.c
803fb7
@@ -3073,7 +3073,7 @@ int getttyname_malloc(int fd, char **ret) {
803fb7
 
803fb7
 int getttyname_harder(int fd, char **r) {
803fb7
         int k;
803fb7
-        char *s;
803fb7
+        char *s = NULL;
803fb7
 
803fb7
         k = getttyname_malloc(fd, &s);
803fb7
         if (k < 0)
803fb7
@@ -3627,7 +3627,7 @@ char **replace_env_argv(char **argv, char **env) {
803fb7
                 /* If $FOO appears as single word, replace it by the split up variable */
803fb7
                 if ((*i)[0] == '$' && (*i)[1] != '{') {
803fb7
                         char *e;
803fb7
-                        char **w, **m;
803fb7
+                        char **w, **m = NULL;
803fb7
                         unsigned q;
803fb7
 
803fb7
                         e = strv_env_get(env, *i+1);
803fb7
diff --git a/src/test/test-path.c b/src/test/test-path.c
803fb7
index 4f9f5c134..a3295aa99 100644
803fb7
--- a/src/test/test-path.c
803fb7
+++ b/src/test/test-path.c
803fb7
@@ -33,7 +33,7 @@ static int setup_test(Manager **m) {
803fb7
         char **tests_path = STRV_MAKE("exists", "existsglobFOOBAR", "changed", "modified", "unit",
803fb7
                                       "directorynotempty", "makedirectory");
803fb7
         char **test_path;
803fb7
-        Manager *tmp;
803fb7
+        Manager *tmp = NULL;
803fb7
         int r;
803fb7
 
803fb7
         assert_se(m);
803fb7
diff --git a/src/test/test-pty.c b/src/test/test-pty.c
803fb7
index cab569a9d..67c125a4c 100644
803fb7
--- a/src/test/test-pty.c
803fb7
+++ b/src/test/test-pty.c
803fb7
@@ -97,7 +97,7 @@ static void run_parent(Pty *pty) {
803fb7
 
803fb7
 static void test_pty(void) {
803fb7
         pid_t pid;
803fb7
-        Pty *pty;
803fb7
+        Pty *pty = NULL;
803fb7
 
803fb7
         rcvsiz = 0;
803fb7
         zero(rcvbuf);
803fb7
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
803fb7
index 489593f4f..ad6a82e50 100644
803fb7
--- a/src/udev/net/link-config.c
803fb7
+++ b/src/udev/net/link-config.c
803fb7
@@ -474,7 +474,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
803fb7
 
803fb7
 int link_get_driver(link_config_ctx *ctx, struct udev_device *device, char **ret) {
803fb7
         const char *name;
803fb7
-        char *driver;
803fb7
+        char *driver = NULL;
803fb7
         int r;
803fb7
 
803fb7
         name = udev_device_get_sysname(device);