diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze/analyze.c | 9 | ||||
-rw-r--r-- | src/basic/strv.c | 2 | ||||
-rw-r--r-- | src/core/service.c | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index c2ebdc3443..a76990360a 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -435,7 +435,7 @@ fail: static int acquire_host_info(sd_bus *bus, struct host_info **hi) { int r; - struct host_info *host; + _cleanup_host_info_ struct host_info *host; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; static const struct bus_properties_map hostname_map[] = { @@ -471,13 +471,12 @@ static int acquire_host_info(sd_bus *bus, struct host_info **hi) { "/org/freedesktop/systemd1", manager_map, host); - if (r < 0) { - free_host_info(host); + if (r < 0) return log_error_errno(r, "Failed to get host information from systemd: %s", bus_error_message(&error, r)); - } *hi = host; + host = NULL; return 0; } @@ -658,7 +657,7 @@ static int analyze_plot(sd_bus *bus) { svg("<rect class=\"background\" width=\"100%%\" height=\"100%%\" />\n"); svg("<text x=\"20\" y=\"50\">%s</text>", pretty_times); svg("<text x=\"20\" y=\"30\">%s %s (%s %s %s) %s %s</text>", - strempty(host->os_pretty_name), + isempty(host->os_pretty_name) ? "Linux" : host->os_pretty_name, strempty(host->hostname), strempty(host->kernel_name), strempty(host->kernel_release), diff --git a/src/basic/strv.c b/src/basic/strv.c index d5169467da..9fe3b5dfff 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -780,7 +780,7 @@ int strv_extend_n(char ***l, const char *value, size_t n) { return 0; rollback: - for (j = k; j < i; i++) + for (j = k; j < i; j++) free(nl[j]); nl[k] = NULL; diff --git a/src/core/service.c b/src/core/service.c index 8c339765a4..ce3b81398d 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -363,8 +363,10 @@ static int service_add_fd_store(Service *s, int fd, const char *name) { fs->fd = fd; fs->service = s; fs->fdname = strdup(name ?: "stored"); - if (!fs->fdname) + if (!fs->fdname) { + free(fs); return -ENOMEM; + } r = sd_event_add_io(UNIT(s)->manager->event, &fs->event_source, fd, 0, on_fd_store_io, fs); if (r < 0) { |