From: Tom Hromatka Date: Mon, 3 Jul 2023 18:26:26 +0000 (-0600) Subject: samples: Fix coverity warning in systemd C example X-Git-Tag: v3.1.0~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c48925b5ebba1767b80803bb51b2abf4836a0660;p=thirdparty%2Flibcgroup.git samples: Fix coverity warning in systemd C example Fix the following coverity warning in the systemd C example: CID 1516633 (#1 of 1): Uninitialized pointer read (UNINIT)5. uninit_use: Using uninitialized value cg. Signed-off-by: Tom Hromatka Reviewed-by: Kamalesh Babulal --- diff --git a/samples/c/create_systemd_scope.c b/samples/c/create_systemd_scope.c index cb77d9b7..cb9ab7d4 100644 --- a/samples/c/create_systemd_scope.c +++ b/samples/c/create_systemd_scope.c @@ -461,10 +461,10 @@ error: static int delete_tmp_cgroup(void) { + struct cgroup *cg = NULL; int ret, pid_cnt, i; int saved_errno = 0; pid_t *pids = NULL; - struct cgroup *cg; ret = cgroup_get_procs(TMP_CGNAME, NULL, &pids, &pid_cnt); if (ret) {