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);
}
static int get_boot_entries(struct boot_info *info) {
- uint16_t *list;
+ uint16_t *list = NULL;
int i, n;
int err = 0;
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;
Manager *m = userdata;
const char *name;
int cleanup;
- Snapshot *s;
+ Snapshot *s = NULL;
int r;
assert(bus);
} 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;
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);
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;
}
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);
}
static int add_any_file(sd_journal *j, const char *path) {
- JournalFile *f;
+ JournalFile *f = NULL;
int r;
assert(j);
}
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,
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;
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] = {};
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);
_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)
}
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;
}
static int defer_handler(sd_event_source *s, void *userdata) {
- sd_event_source *p;
+ sd_event_source *p = NULL;
sigset_t ss;
assert(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)
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);
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);
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)
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);
}
int link_add(Manager *m, struct udev_device *device, Link **ret) {
- Link *link;
+ Link *link = NULL;
Network *network;
int r;
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;
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;
#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;
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;
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);
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);
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 */
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);
#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;
#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;
}
static int test_unit_printf(void) {
- Manager *m;
+ Manager *m = NULL;
Unit *u, *u2;
int r;
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], "");
} 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) {
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;