]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
cgxget: Fix clang warning
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 29 Jul 2025 16:17:13 +0000 (16:17 +0000)
committerKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 1 Aug 2025 09:02:21 +0000 (14:32 +0530)
commitaeef26440d22a13e48206cec494f97a04e82b1f8
treef9685adb69fd9e5c791034777f51e6d346e62ee3
parent1a1f5090c6bad3c62b9ca278a97478f0710fe9b9
cgxget: Fix clang warning

Fix the following clang warning by explicitily initializing disk_cg to
NULL.

tools/cgxget.c:903:6: warning: variable 'disk_cg' is used uninitialized
whenever 'if' condition is true [-Wsometimes-uninitialized]
  903 |         if (!cg || !(*cg)) {
      |             ^~~~~~~~~~~~~
tools/cgxget.c:940:6: note: uninitialized use occurs here
  940 |         if (disk_cg)
      |             ^~~~~~~
tools/cgxget.c:903:2: note: remove the 'if' if its condition is always
false
  903 |         if (!cg || !(*cg)) {
      |         ^~~~~~~~~~~~~~~~~~~~
  904 |                 ret = ECGINVAL;
      |                 ~~~~~~~~~~~~~~~
  905 |                 goto out;
      |                 ~~~~~~~~~
  906 |         }
      |         ~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
src/tools/cgxget.c