Task #91648 - fixed.err

back to task #91648
download
Error: GCC_ANALYZER_WARNING (CWE-401):
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):
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):
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):
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))