Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'libcrun_get_cgroup_dirfd'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c:968:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_cgroup, 2818048)'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'libcrun_get_cgroup_dirfd'
#  966|       return ret;
#  967|   
#  968|->   cgroupdirfd = open (path_to_cgroup, O_CLOEXEC | O_NOFOLLOW | O_DIRECTORY | O_PATH);
#  969|     if (UNLIKELY (cgroupdirfd < 0))
#  970|       return crun_make_error (err, errno, "open `%s`", path_to_cgroup);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-internal.h:22: included_from: Included from here.
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c:23: included_from: Included from here.
crun-1.20-build/crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'write_controller_file'
crun-1.20-build/crun-HEAD/src/libcrun/utils.h:65:21: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(controllers_len + 1)'
crun-1.20-build/crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
crun-1.20-build/crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
#   63|   {
#   64|     void *res = malloc (size);
#   65|->   if (UNLIKELY (res == NULL))
#   66|       OOM ();
#   67|     return res;

Error: GCC_ANALYZER_WARNING (CWE-415): [#def3]
crun-1.20-build/crun-HEAD/src/libcrun/utils.h:92:3: warning[-Wanalyzer-double-free]: double-'free' of '*(void **)&cgroup_path_type'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
#   90|   {
#   91|     void **pp = (void **) p;
#   92|->   free (*pp);
#   93|   }
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-415): [#def4]
crun-1.20-build/crun-HEAD/src/libcrun/utils.h:92:3: warning[-Wanalyzer-double-free]: double-'free' of '*(void **)&content'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/cgroup-utils.c: scope_hint: In function 'maybe_make_cgroup_threaded'
#   90|   {
#   91|     void **pp = (void **) p;
#   92|->   free (*pp);
#   93|   }
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
crun-1.20-build/crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'maybe_make_cgroup_threaded'
crun-1.20-build/crun-HEAD/src/libcrun/utils.h:225:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(t)'
#  223|   
#  224|     ret = strdup (str);
#  225|->   if (ret == NULL)
#  226|       OOM ();
#  227|   

Scan Properties

analyzer-version-clippy1.85.0
analyzer-version-cppcheck2.17 dev
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.85.0
diffbase-analyzer-version-cppcheck2.17 dev
diffbase-analyzer-version-gcc15.0.1
diffbase-analyzer-version-gcc-analyzer15.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-76.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namecrun-1.20-1.20250226134558283769.pr1679.49.ga18b4cc3
diffbase-store-results-to/tmp/tmpfmwkhsyi/crun-1.20-1.20250226134558283769.pr1679.49.ga18b4cc3.tar.xz
diffbase-time-created2025-02-26 14:02:03
diffbase-time-finished2025-02-26 14:09:38
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,unicontrol,clippy,gcc,cppcheck' '-o' '/tmp/tmpfmwkhsyi/crun-1.20-1.20250226134558283769.pr1679.49.ga18b4cc3.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpfmwkhsyi/crun-1.20-1.20250226134558283769.pr1679.49.ga18b4cc3.src.rpm'
diffbase-tool-versioncsmock-3.8.0-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-76.us-west-2.compute.internal
mock-configfedora-rawhide-x86_64
project-namecrun-1.20-1.20250225075436779197.main.45.ga1652fd6
store-results-to/tmp/tmpq45dpbgp/crun-1.20-1.20250225075436779197.main.45.ga1652fd6.tar.xz
time-created2025-02-26 13:53:36
time-finished2025-02-26 14:01:36
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,unicontrol,clippy,gcc,cppcheck' '-o' '/tmp/tmpq45dpbgp/crun-1.20-1.20250225075436779197.main.45.ga1652fd6.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpq45dpbgp/crun-1.20-1.20250225075436779197.main.45.ga1652fd6.src.rpm'
tool-versioncsmock-3.8.0-1.el9