ryantimwilson / rpms / systemd

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