[systemd-devel] [PATCH] journal-remote: check return code of sd_event_default

2014-09-18 Thread Andreas Henriksson
Handle sd_event_default returning error and bail out properly as done in every other caller of this function. Found by coverity. Fixes: CID#1238957 --- src/journal-remote/journal-remote.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/journal-remote/journal-remote.c

[systemd-devel] [PATCH] shared: fix resource leak in config_parse_default_instance

2014-09-16 Thread Andreas Henriksson
The recently allocated "printed" is not freed on error path. Found by coverity. Fixes: CID#1237745 --- src/shared/install.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/install.c b/src/shared/install.c index 5d3fcf5..61e572b 100644 --- a/src/shared/install.c +

[systemd-devel] [PATCH] sysv-generator: fix resource leak

2014-09-16 Thread Andreas Henriksson
The "unit" string allocation is not freed on either error or success path. Found by coverity. Fixes: CID#1237755 --- src/sysv-generator/sysv-generator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c i

[systemd-devel] [PATCH] core: fix resource leak in manager_environment_add

2014-09-16 Thread Andreas Henriksson
Second error path must free the (potentially) allocated memory in the first code chunk before returning. Found by coverity. Fixes: CID#1237750 --- src/core/manager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/manager.c b/src/core/manager.c index 0770727..e0c1c

[systemd-devel] [PATCH] bootchart: oom-check correct variable

2014-09-16 Thread Andreas Henriksson
Coverity warned that we have already dereferenced ps->sample before null-checking it. I suspect that's not really the issue and that the check is checking the wrong variable. Likely the oom-check should be on the just allocated ps->sample->next. Found by coverity. Fixes: CID#1237765 --- src/bootc

[systemd-devel] [PATCH] libsystemd-network: avoid double-free in error case

2014-09-16 Thread Andreas Henriksson
Don't manually free 'n' in error path as it's already tagged _cleanup_free_ and will be freed once it goes out of scope, leading to double-free in this case. Found with coverity. Fixes: CID#1237786 Signed-off-by: Andreas Henriksson --- src/libsystemd-network/network-inte

Re: [systemd-devel] [PATCH 2/4] core: fix invalid free() in killall()

2014-06-15 Thread Andreas Henriksson
On Sun, Jun 15, 2014 at 07:51:10AM +0400, Andrey Borzenkov wrote: > В Fri, 13 Jun 2014 18:48:19 +0200 > Andreas Henriksson пишет: > [...] > > +_cleanup_free_ char *s = NULL; > > > > get_process_comm(pid, &s); &g

Re: [systemd-devel] [PATCH 0/4] looking at _cleanup_free_ usage

2014-06-13 Thread Andreas Henriksson
ut-directly-after in the code now.) Regards, Andreas Henriksson ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] [PATCH 0/4] looking at _cleanup_free_ usage

2014-06-13 Thread Andreas Henriksson
here any static code analyzers that can catch these errors that can be used to avoid relying on manual reviews catching these errors? Any other ideas? Have a great weekend! Regards, Andreas Henriksson Andreas Henriksson (4): install: fix invalid free() in unit_file_mask() core: fix invalid

[systemd-devel] [PATCH 1/4] install: fix invalid free() in unit_file_mask()

2014-06-13 Thread Andreas Henriksson
h(...)). Signed-off-by: Andreas Henriksson --- src/shared/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/install.c b/src/shared/install.c index 487d0f6..f562063 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -563,7 +563,7 @

[systemd-devel] [PATCH 2/4] core: fix invalid free() in killall()

2014-06-13 Thread Andreas Henriksson
to nothing else initializing it before the scope it is in finishes. Signed-off-by: Andreas Henriksson --- src/core/killall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/killall.c b/src/core/killall.c index 57ed41c..eab48f7 100644 --- a/src/core/killall.c +++

[systemd-devel] [PATCH 3/4] sd-dhcp-client: fix invalid free() in client_send_request()

2014-06-13 Thread Andreas Henriksson
t; being initialized. Signed-off-by: Andreas Henriksson --- src/libsystemd-network/sd-dhcp-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 8f54906..2a46624 100644 --- a/src/libsys

[systemd-devel] [PATCH 4/4] udev: fix invalid free() in enable_name_policy()

2014-06-13 Thread Andreas Henriksson
static bool enable_name_policy(...) in ./src/udev/net/link-config.c calls proc_cmdline(...) to get "line" initialized, but proc_cmdline(...) does not guarantee that atleast when both conditions (detect_container(NULL) > 0) and read_full_file(...) returned < 0. Signed-off-by: An