From eec006f5667f586c3cecffdb16c84e08a059d44a Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Tue, 4 Jul 2023 12:04:51 +0530 Subject: [PATCH] api: fix missing goto in cgroup_get_current_controller_path() Fix missing goto on error in cgroup_get_current_controller_path(), it was reported by Coverity tool as unused value: CID 320875 (#1 of 1): Unused value (UNUSED_VALUE)assigned_value: Assigning value ECGOTHER to ret here, but that stored value is overwritten before it can be used. It turns out that, it is more than an over-written value, the strdup() was missing goto error path statement on failure, add it. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- src/api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api.c b/src/api.c index e24805cd..0a4f0066 100644 --- a/src/api.c +++ b/src/api.c @@ -4936,6 +4936,7 @@ int cgroup_get_current_controller_path(pid_t pid, const char *controller, char * if (!*current_path) { last_errno = errno; ret = ECGOTHER; + goto done; } ret = 0; goto done; -- 2.47.2