Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1266:14: warning[-Wanalyzer-malloc-leak]: leak of ‘hdr’
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1255:15: acquire_memory: allocated here
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1257:12: branch_false: following ‘false’ branch...
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1263:9: branch_false: ...to here
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1266:14: throw: if ‘open’ throws an exception...
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1266:14: danger: ‘hdr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
# 1264|   
# 1265|   	sprintf(file_path, DEFAULT_TELEMETRY_BIN);
# 1266|-> 	fd = open(file_path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
# 1267|   	if (fd < 0) {
# 1268|   		fprintf(stderr, "Failed to open output file %s: %s!\n",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1266:14: warning[-Wanalyzer-malloc-leak]: leak of ‘telemetry_log’
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1256:25: acquire_memory: allocated here
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1257:12: branch_false: following ‘false’ branch...
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1263:9: branch_false: ...to here
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1266:14: throw: if ‘open’ throws an exception...
nvme-cli-2.15/plugins/ocp/ocp-nvme.c:1266:14: danger: ‘telemetry_log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
# 1264|   
# 1265|   	sprintf(file_path, DEFAULT_TELEMETRY_BIN);
# 1266|-> 	fd = open(file_path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
# 1267|   	if (fd < 0) {
# 1268|   		fprintf(stderr, "Failed to open output file %s: %s!\n",

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1533:37: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*options.output_file, "w")’
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1526:12: branch_true: following ‘true’ branch...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1527:28: branch_true: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1527:28: acquire_resource: opened here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1529:20: branch_true: following ‘true’ branch...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1530:25: branch_true: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1533:28: branch_true: following ‘true’ branch (when the strings are equal)...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1534:37: branch_true: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1534:36: branch_false: following ‘false’ branch...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1538:41: branch_false: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1538:41: throw: if ‘generic_structure_parser’ throws an exception...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1533:37: danger: ‘fopen(*options.output_file, "w")’ leaks here; was opened at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
# 1531|   			fprintf(fp, "%s\n", STR_LOG_PAGE_HEADER);
# 1532|   			fprintf(fp, STR_LINE);
# 1533|-> 			if (!strcmp(options->telemetry_type, "host")) {
# 1534|   				if ((ptelemetry_buffer == NULL) ||
# 1535|   					(ARRAY_SIZE(host_log_page_header) == 0))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1533:37: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*options.output_file, "w")’
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1526:12: branch_true: following ‘true’ branch...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1527:28: branch_true: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1527:28: acquire_memory: allocated here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1529:20: branch_true: following ‘true’ branch...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1530:25: branch_true: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1533:28: branch_true: following ‘true’ branch (when the strings are equal)...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1534:37: branch_true: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1534:36: branch_false: following ‘false’ branch...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1538:41: branch_false: ...to here
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1538:41: throw: if ‘generic_structure_parser’ throws an exception...
nvme-cli-2.15/plugins/ocp/ocp-telemetry-decode.c:1533:37: danger: ‘fopen(*options.output_file, "w")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
# 1531|   			fprintf(fp, "%s\n", STR_LOG_PAGE_HEADER);
# 1532|   			fprintf(fp, STR_LINE);
# 1533|-> 			if (!strcmp(options->telemetry_type, "host")) {
# 1534|   				if ((ptelemetry_buffer == NULL) ||
# 1535|   					(ARRAY_SIZE(host_log_page_header) == 0))

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-79.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namenvme-cli-2.16-1.fc44
diffbase-store-results-to/tmp/tmp0bc8olow/nvme-cli-2.16-1.fc44.tar.xz
diffbase-time-created2026-01-08 19:47:02
diffbase-time-finished2026-01-08 19:49:23
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp0bc8olow/nvme-cli-2.16-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp0bc8olow/nvme-cli-2.16-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-79.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namenvme-cli-2.15-2.fc43
store-results-to/tmp/tmpe_wrocd0/nvme-cli-2.15-2.fc43.tar.xz
time-created2026-01-08 19:43:37
time-finished2026-01-08 19:46:28
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpe_wrocd0/nvme-cli-2.15-2.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpe_wrocd0/nvme-cli-2.15-2.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9