From: Tom Hromatka Date: Mon, 3 Jul 2023 18:24:56 +0000 (-0600) Subject: samples: Fix coverity warning in systemd C example X-Git-Tag: v3.1.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33a687525266e771e6a1afc5c06e03b89bc193cf;p=thirdparty%2Flibcgroup.git samples: Fix coverity warning in systemd C example Fix the following coverity warning in the systemd C example: CID 1516634 (#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 2273d293..cb77d9b7 100644 --- a/samples/c/create_systemd_scope.c +++ b/samples/c/create_systemd_scope.c @@ -209,10 +209,10 @@ error: static int move_pids_to_tmp_cgroup(const struct example_opts * const opts) { + struct cgroup *cg = NULL; int ret, pid_cnt, i; pid_t *pids = NULL; int saved_ret = 0; - struct cgroup *cg; /* * Since we told libcgroup that our slice and scope are the default, we can