summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backlight/backlight.c2
-rw-r--r--src/boot/boot-efi.c2
-rw-r--r--src/cgtop/cgtop.c2
-rw-r--r--src/core/dbus-manager.c2
-rw-r--r--src/hostname/hostnamectl.c2
-rw-r--r--src/journal/journal-gatewayd.c4
-rw-r--r--src/journal/journalctl.c2
-rw-r--r--src/journal/sd-journal.c2
-rw-r--r--src/libsystemd/sd-bus/bus-control.c4
-rw-r--r--src/libsystemd/sd-bus/bus-message.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-memfd.c2
-rw-r--r--src/libsystemd/sd-event/sd-event.c4
-rw-r--r--src/libsystemd/sd-event/test-event.c4
-rw-r--r--src/login/logind-session.c4
-rw-r--r--src/login/test-login.c2
-rw-r--r--src/machine/machine.c4
-rw-r--r--src/network/networkd-link.c2
-rw-r--r--src/nspawn/nspawn.c2
-rw-r--r--src/shared/acpi-fpdt.c2
-rw-r--r--src/shared/boot-timestamps.c2
-rw-r--r--src/shared/efivars.c4
-rw-r--r--src/shared/sleep-config.c4
-rw-r--r--src/shared/socket-util.c2
-rw-r--r--src/shared/util.c2
-rw-r--r--src/test/test-cgroup-mask.c2
-rw-r--r--src/test/test-sched-prio.c2
-rw-r--r--src/test/test-unit-name.c2
-rw-r--r--src/test/test-util.c4
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c2
-rw-r--r--src/udev/udev-ctrl.c2
30 files changed, 39 insertions, 39 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 7d7c0845d9..86f10cc0cf 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -64,7 +64,7 @@ static struct udev_device *find_pci_or_platform_parent(struct udev_device *devic
value = udev_device_get_sysattr_value(parent, "class");
if (value) {
- unsigned long class;
+ unsigned long class = 0;
if (safe_atolu(value, &class) < 0) {
log_warning("Cannot parse PCI class %s of device %s:%s.", value, subsystem, sysname);
diff --git a/src/boot/boot-efi.c b/src/boot/boot-efi.c
index 426652595e..bd0c59bd5a 100644
--- a/src/boot/boot-efi.c
+++ b/src/boot/boot-efi.c
@@ -50,7 +50,7 @@ static char *tilt_slashes(char *s) {
}
static int get_boot_entries(struct boot_info *info) {
- uint16_t *list;
+ uint16_t *list = NULL;
int i, n;
int err = 0;
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index c56f7a861f..fd0023b0a8 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -98,7 +98,7 @@ static void group_hashmap_free(Hashmap *h) {
static int process(const char *controller, const char *path, Hashmap *a, Hashmap *b, unsigned iteration) {
Group *g;
int r;
- FILE *f;
+ FILE *f = NULL;
pid_t pid;
unsigned n;
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 6abd599370..a9b8fad25c 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -873,7 +873,7 @@ static int method_create_snapshot(sd_bus *bus, sd_bus_message *message, void *us
Manager *m = userdata;
const char *name;
int cleanup;
- Snapshot *s;
+ Snapshot *s = NULL;
int r;
assert(bus);
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 3150396c70..afbf37db51 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -69,7 +69,7 @@ typedef struct StatusInfo {
} StatusInfo;
static void print_status_info(StatusInfo *i) {
- sd_id128_t mid, bid;
+ sd_id128_t mid = {}, bid = {};
int r;
const char *id = NULL;
_cleanup_free_ char *pretty_name = NULL, *cpe_name = NULL;
diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c
index 5c35d8e77e..7e97a3588c 100644
--- a/src/journal/journal-gatewayd.c
+++ b/src/journal/journal-gatewayd.c
@@ -744,7 +744,7 @@ static int request_handler_file(
static int get_virtualization(char **v) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
- char *b;
+ char *b = NULL;
int r;
r = sd_bus_default_system(&bus);
@@ -780,7 +780,7 @@ static int request_handler_machine(
RequestMeta *m = connection_cls;
int r;
_cleanup_free_ char* hostname = NULL, *os_name = NULL;
- uint64_t cutoff_from, cutoff_to, usage;
+ uint64_t cutoff_from = 0, cutoff_to = 0, usage;
char *json;
sd_id128_t mid, bid;
_cleanup_free_ char *v = NULL;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index d406daeae9..a328ba11b0 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1651,7 +1651,7 @@ int main(int argc, char *argv[]) {
}
if (arg_action == ACTION_DISK_USAGE) {
- uint64_t bytes;
+ uint64_t bytes = 0;
char sbytes[FORMAT_BYTES_MAX];
r = sd_journal_get_usage(j, &bytes);
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 6abbacf004..fa2009c5dc 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1281,7 +1281,7 @@ static bool file_type_wanted(int flags, const char *filename) {
}
static int add_any_file(sd_journal *j, const char *path) {
- JournalFile *f;
+ JournalFile *f = NULL;
int r;
assert(j);
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 846307d664..b4dbb5b7ee 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -687,8 +687,8 @@ static int bus_get_owner_dbus1(
}
if (mask & SD_BUS_CREDS_SELINUX_CONTEXT) {
- const void *p;
- size_t sz;
+ const void *p = NULL;
+ size_t sz = 0;
r = sd_bus_call_method(
bus,
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 323413406a..fe84f3f0bc 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -1863,7 +1863,7 @@ _public_ int sd_bus_message_open_container(
struct bus_container *c, *w;
uint32_t *array_size = NULL;
char *signature;
- size_t before, begin;
+ size_t before, begin = 0;
bool need_offsets = false;
int r;
diff --git a/src/libsystemd/sd-bus/test-bus-memfd.c b/src/libsystemd/sd-bus/test-bus-memfd.c
index f7197ed096..f0f08ba818 100644
--- a/src/libsystemd/sd-bus/test-bus-memfd.c
+++ b/src/libsystemd/sd-bus/test-bus-memfd.c
@@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
char *s, *name;
uint64_t sz;
int r, fd;
- FILE *f;
+ FILE *f = NULL;
char buf[3] = {};
struct iovec iov[3] = {};
char bufv[3][3] = {};
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index cf2efa68a3..cda92e2604 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -642,9 +642,9 @@ static int event_setup_timer_fd(
int *timer_fd,
clockid_t id) {
+ sd_id128_t bootid = {};
struct epoll_event ev = {};
int r, fd;
- sd_id128_t bootid;
assert(e);
assert(timer_fd);
@@ -2126,7 +2126,7 @@ _public_ int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) {
_public_ int sd_event_default(sd_event **ret) {
static thread_local sd_event *default_event = NULL;
- sd_event *e;
+ sd_event *e = NULL;
int r;
if (!ret)
diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c
index 28ef6a3692..c10aa8caa7 100644
--- a/src/libsystemd/sd-event/test-event.c
+++ b/src/libsystemd/sd-event/test-event.c
@@ -76,7 +76,7 @@ static int child_handler(sd_event_source *s, const siginfo_t *si, void *userdata
}
static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
- sd_event_source *p;
+ sd_event_source *p = NULL;
sigset_t ss;
pid_t pid;
@@ -106,7 +106,7 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si,
}
static int defer_handler(sd_event_source *s, void *userdata) {
- sd_event_source *p;
+ sd_event_source *p = NULL;
sigset_t ss;
assert(s);
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index d7c074bdce..dc1d81c4be 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -480,7 +480,7 @@ static int session_start_scope(Session *s) {
if (!s->scope) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_free_ char *description = NULL;
- char *scope, *job;
+ char *scope, *job = NULL;
description = strjoin("Session ", s->id, " of user ", s->user->name, NULL);
if (!description)
@@ -567,7 +567,7 @@ int session_start(Session *s) {
static int session_stop_scope(Session *s, bool force) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- char *job;
+ char *job = NULL;
int r;
assert(s);
diff --git a/src/login/test-login.c b/src/login/test-login.c
index ce88af80f0..d78cea46af 100644
--- a/src/login/test-login.c
+++ b/src/login/test-login.c
@@ -39,7 +39,7 @@ static void test_login(void) {
uid_t *uids;
unsigned n;
struct pollfd pollfd;
- sd_login_monitor *m;
+ sd_login_monitor *m = NULL;
assert_se(sd_pid_get_session(0, &session) == 0);
printf("session = %s\n", session);
diff --git a/src/machine/machine.c b/src/machine/machine.c
index e45c443495..4596a80838 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -252,7 +252,7 @@ static int machine_start_scope(Machine *m, sd_bus_message *properties, sd_bus_er
if (!m->unit) {
_cleanup_free_ char *escaped = NULL;
- char *scope, *description, *job;
+ char *scope, *description, *job = NULL;
escaped = unit_name_escape(m->name);
if (!escaped)
@@ -322,7 +322,7 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) {
static int machine_stop_scope(Machine *m) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- char *job;
+ char *job = NULL;
int r;
assert(m);
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 37bc5ab594..e574b2c874 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -105,7 +105,7 @@ int link_get(Manager *m, int ifindex, Link **ret) {
}
int link_add(Manager *m, struct udev_device *device, Link **ret) {
- Link *link;
+ Link *link = NULL;
Network *network;
int r;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 350dc93cf9..62c2e2ef09 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -743,7 +743,7 @@ static int setup_resolv_conf(const char *dest) {
static int setup_boot_id(const char *dest) {
_cleanup_free_ char *from = NULL, *to = NULL;
- sd_id128_t rnd;
+ sd_id128_t rnd = {};
char as_uuid[37];
int r;
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index 7bae47f85f..390c3236e0 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -83,7 +83,7 @@ struct acpi_fpdt_boot {
int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
_cleanup_free_ char *buf = NULL;
struct acpi_table_header *tbl;
- size_t l;
+ size_t l = 0;
struct acpi_fpdt_header *rec;
int r;
uint64_t ptr = 0;
diff --git a/src/shared/boot-timestamps.c b/src/shared/boot-timestamps.c
index d656685774..54e0537a21 100644
--- a/src/shared/boot-timestamps.c
+++ b/src/shared/boot-timestamps.c
@@ -26,7 +26,7 @@
#include "efivars.h"
int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
- usec_t x, y, a;
+ usec_t x = 0, y = 0, a;
int r;
dual_timestamp _n;
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 000dae9de0..5ee8f1eb0b 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -130,7 +130,7 @@ int efi_get_variable(
int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p) {
_cleanup_free_ void *s = NULL;
- size_t ss;
+ size_t ss = 0;
int r;
char *x;
@@ -393,7 +393,7 @@ fail:
static int read_usec(sd_id128_t vendor, const char *name, usec_t *u) {
_cleanup_free_ char *j = NULL;
int r;
- uint64_t x;
+ uint64_t x = 0;
assert(name);
assert(u);
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index b9b6643066..cf1cd400e8 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -220,8 +220,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
static bool enough_memory_for_hibernation(void) {
_cleanup_free_ char *active = NULL;
- unsigned long long act;
- size_t size, used;
+ unsigned long long act = 0;
+ size_t size = 0, used = 0;
int r;
r = hibernation_partition_size(&size, &used);
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 6d9c303529..5ef2e2244c 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -585,7 +585,7 @@ int getpeername_pretty(int fd, char **ret) {
return -errno;
if (sa.sa.sa_family == AF_UNIX) {
- struct ucred ucred;
+ struct ucred ucred = {};
/* UNIX connection sockets are anonymous, so let's use
* PID/UID as pretty credentials instead */
diff --git a/src/shared/util.c b/src/shared/util.c
index 55246f5a4d..35e4338c3a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5903,7 +5903,7 @@ int proc_cmdline(char **ret) {
int r;
if (detect_container(NULL) > 0) {
- char *buf, *p;
+ char *buf = NULL, *p;
size_t sz = 0;
r = read_full_file("/proc/1/cmdline", &buf, &sz);
diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c
index 3414ed4d60..4d60859513 100644
--- a/src/test/test-cgroup-mask.c
+++ b/src/test/test-cgroup-mask.c
@@ -32,7 +32,7 @@
#include "test-helper.h"
static int test_cgroup_mask(void) {
- Manager *m;
+ Manager *m = NULL;
Unit *son, *daughter, *parent, *root, *grandchild, *parent_deep;
FILE *serial = NULL;
FDSet *fdset = NULL;
diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c
index a4cc3d44a2..e984ee4203 100644
--- a/src/test/test-sched-prio.c
+++ b/src/test/test-sched-prio.c
@@ -25,7 +25,7 @@
#include "macro.h"
int main(int argc, char *argv[]) {
- Manager *m;
+ Manager *m = NULL;
Unit *idle_ok, *idle_bad, *rr_ok, *rr_bad, *rr_sched;
Service *ser;
FILE *serial = NULL;
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index c10ec608af..fff3e16ed8 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -110,7 +110,7 @@ static void test_replacements(void) {
}
static int test_unit_printf(void) {
- Manager *m;
+ Manager *m = NULL;
Unit *u, *u2;
int r;
diff --git a/src/test/test-util.c b/src/test/test-util.c
index cbd60d68f7..1ac4a1edd1 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -567,11 +567,11 @@ static void test_in_set(void) {
static void test_writing_tmpfile(void) {
char name[] = "/tmp/test-systemd_writing_tmpfile.XXXXXX";
- _cleanup_free_ char *contents;
+ _cleanup_free_ char *contents = NULL;
size_t size;
int fd, r;
-
struct iovec iov[3];
+
IOVEC_SET_STRING(iov[0], "abc\n");
IOVEC_SET_STRING(iov[1], ALPHANUMERICAL "\n");
IOVEC_SET_STRING(iov[2], "");
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index 08177c6d04..7a90e6507f 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -361,7 +361,7 @@ static int parse_password(const char *filename, char **wall) {
} else {
int tty_fd = -1;
- char *password;
+ char *password = NULL;
if (arg_console)
if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) {
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 2633423352..1e91ec20a1 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -180,7 +180,7 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl)
struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
{
struct udev_ctrl_connection *conn;
- struct ucred ucred;
+ struct ucred ucred = {};
const int on = 1;
int r;