Fixed findings

List of Findings

Error: SHELLCHECK_WARNING (CWE-140): [#def1]
/usr/share/bash-completion/completions/flashrom.bash:36:16: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#   34|   			;;
#   35|   		'-p'|'--programmer')
#   36|-> 			COMPREPLY=( $(compgen -W "asm106x atavia buspirate_spi ch341a_spi ch347_spi dediprog developerbox_spi digilent_spi dirtyjtag_spi drkaiser dummy ft2232_spi gfxnvidia internal it8212 jlink_spi linux_mtd linux_spi nic3com nicintel nicintel_eeprom nicintel_spi nicrealtek ogp_spi pickit2_spi pony_spi raiden_debug_spi rayer_spi satamv satasii serprog stlinkv3_spi usbblaster_spi " -- $cur) )
#   37|   			return 0
#   38|   			;;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
flashrom-1.4.0/flashrom.c:376:17: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  374|   {
#  375|   	if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.get_region) {
#  376|-> 		flash->mst->opaque.get_region(flash, addr, region);
#  377|   	} else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
#  378|   		flash->mst->spi.get_region(flash, addr, region);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
flashrom-1.4.0/flashrom.c:376:17: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  374|   {
#  375|   	if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.get_region) {
#  376|-> 		flash->mst->opaque.get_region(flash, addr, region);
#  377|   	} else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
#  378|   		flash->mst->spi.get_region(flash, addr, region);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
flashrom-1.4.0/flashrom.c:376:17: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
#  374|   {
#  375|   	if ((flash->mst->buses_supported & BUS_PROG) && flash->mst->opaque.get_region) {
#  376|-> 		flash->mst->opaque.get_region(flash, addr, region);
#  377|   	} else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
#  378|   		flash->mst->spi.get_region(flash, addr, region);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
flashrom-1.4.0/flashrom.c:378:17: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  376|   		flash->mst->opaque.get_region(flash, addr, region);
#  377|   	} else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
#  378|-> 		flash->mst->spi.get_region(flash, addr, region);
#  379|   	} else {
#  380|   		region->name = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
flashrom-1.4.0/flashrom.c:378:17: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  376|   		flash->mst->opaque.get_region(flash, addr, region);
#  377|   	} else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
#  378|-> 		flash->mst->spi.get_region(flash, addr, region);
#  379|   	} else {
#  380|   		region->name = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
flashrom-1.4.0/flashrom.c:378:17: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
#  376|   		flash->mst->opaque.get_region(flash, addr, region);
#  377|   	} else if (flash->mst->buses_supported & BUS_SPI && flash->mst->spi.get_region) {
#  378|-> 		flash->mst->spi.get_region(flash, addr, region);
#  379|   	} else {
#  380|   		region->name = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
flashrom-1.4.0/flashrom.c:382:31: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  380|   		region->name = strdup("");
#  381|   		region->start = 0;
#  382|-> 		region->end = flashrom_flash_getsize(flash) - 1;
#  383|   		region->read_prot = false;
#  384|   		region->write_prot = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
flashrom-1.4.0/flashrom.c:382:31: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  380|   		region->name = strdup("");
#  381|   		region->start = 0;
#  382|-> 		region->end = flashrom_flash_getsize(flash) - 1;
#  383|   		region->read_prot = false;
#  384|   		region->write_prot = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
flashrom-1.4.0/flashrom.c:382:31: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
#  380|   		region->name = strdup("");
#  381|   		region->start = 0;
#  382|-> 		region->end = flashrom_flash_getsize(flash) - 1;
#  383|   		region->read_prot = false;
#  384|   		region->write_prot = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
flashrom-1.4.0/flashrom.c:599:28: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  597|   		get_flash_region(flash, addr, &region);
#  598|   
#  599|-> 		read_len = min(start + len, region.end + 1) - addr;
#  600|   		uint8_t *rbuf = buf + addr - start;
#  601|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
flashrom-1.4.0/flashrom.c:599:28: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  597|   		get_flash_region(flash, addr, &region);
#  598|   
#  599|-> 		read_len = min(start + len, region.end + 1) - addr;
#  600|   		uint8_t *rbuf = buf + addr - start;
#  601|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
flashrom-1.4.0/flashrom.c:599:28: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
#  597|   		get_flash_region(flash, addr, &region);
#  598|   
#  599|-> 		read_len = min(start + len, region.end + 1) - addr;
#  600|   		uint8_t *rbuf = buf + addr - start;
#  601|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
flashrom-1.4.0/flashrom.c:604:33: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  602|   		if (region.read_prot) {
#  603|   			if (flash->flags.skip_unreadable_regions) {
#  604|-> 				msg_gdbg("%s: cannot read inside %s region (%#08"PRIx32"..%#08"PRIx32"), "
#  605|   					 "filling (%#08x..%#08x) with erased value instead.\n",
#  606|   					 __func__, region.name, region.start, region.end,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
flashrom-1.4.0/flashrom.c:604:33: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
#  602|   		if (region.read_prot) {
#  603|   			if (flash->flags.skip_unreadable_regions) {
#  604|-> 				msg_gdbg("%s: cannot read inside %s region (%#08"PRIx32"..%#08"PRIx32"), "
#  605|   					 "filling (%#08x..%#08x) with erased value instead.\n",
#  606|   					 __func__, region.name, region.start, region.end,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
flashrom-1.4.0/flashrom.c:604:33: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1656:42: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1657:29: call_function: calling ‘read_flash’ from ‘read_erase_write_block’
#  602|   		if (region.read_prot) {
#  603|   			if (flash->flags.skip_unreadable_regions) {
#  604|-> 				msg_gdbg("%s: cannot read inside %s region (%#08"PRIx32"..%#08"PRIx32"), "
#  605|   					 "filling (%#08x..%#08x) with erased value instead.\n",
#  606|   					 __func__, region.name, region.start, region.end,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
flashrom-1.4.0/flashrom.c:860:25: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1664:21: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1664:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1682:38: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1684:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1693:22: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1695:27: call_function: calling ‘get_next_write’ from ‘read_erase_write_block’
#  858|   	}
#  859|   	for (i = 0; i < len / stride; i++) {
#  860|-> 		limit = min(stride, len - i * stride);
#  861|   		/* Are 'have' and 'want' identical? */
#  862|   		if (memcmp(have + i * stride, want + i * stride, limit)) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
flashrom-1.4.0/flashrom.c:878:29: warning[-Wanalyzer-malloc-leak]: leak of ‘newc’
flashrom-1.4.0/flashrom.c:1626:12: enter_function: entry to ‘read_erase_write_block’
flashrom-1.4.0/flashrom.c:1646:39: acquire_memory: allocated here
flashrom-1.4.0/flashrom.c:1647:20: branch_false: following ‘false’ branch (when ‘newc’ is non-NULL)...
flashrom-1.4.0/flashrom.c:1651:30: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1654:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1664:21: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1664:20: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1682:38: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1684:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/flashrom.c:1693:22: branch_false: ...to here
flashrom-1.4.0/flashrom.c:1695:27: call_function: calling ‘get_next_write’ from ‘read_erase_write_block’
#  876|   	}
#  877|   	if (need_write)
#  878|-> 		first_len = min(i * stride - rel_start, len);
#  879|   	*first_start += rel_start;
#  880|   	return first_len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
flashrom-1.4.0/flashrom.c:1470:25: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1468|   		erased_contents = malloc(erase_len);
# 1469|   		if (!backup_contents || !erased_contents) {
# 1470|-> 			msg_cerr("Out of memory!\n");
# 1471|   			ret = 1;
# 1472|   			goto _free_ret;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
flashrom-1.4.0/flashrom.c:1470:25: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1468|   		erased_contents = malloc(erase_len);
# 1469|   		if (!backup_contents || !erased_contents) {
# 1470|-> 			msg_cerr("Out of memory!\n");
# 1471|   			ret = 1;
# 1472|   			goto _free_ret;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
flashrom-1.4.0/flashrom.c:1477:17: warning[-Wanalyzer-malloc-leak]: leak of ‘backup_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1475|   		memset(erased_contents, ERASED_VALUE(flashctx), erase_len);
# 1476|   
# 1477|-> 		msg_cdbg("R");
# 1478|   		/* Merge data preceding the current region. */
# 1479|   		if (info->region_start > info->erase_start) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
flashrom-1.4.0/flashrom.c:1477:17: warning[-Wanalyzer-malloc-leak]: leak of ‘erased_contents’
flashrom-1.4.0/flashrom.c:1619:12: enter_function: entry to ‘erase_by_layout’
flashrom-1.4.0/flashrom.c:1621:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/flashrom.c:1622:24: branch_true: ...to here
flashrom-1.4.0/flashrom.c:1622:24: call_function: calling ‘erase_by_layout_legacy’ from ‘erase_by_layout’
# 1475|   		memset(erased_contents, ERASED_VALUE(flashctx), erase_len);
# 1476|   
# 1477|-> 		msg_cdbg("R");
# 1478|   		/* Merge data preceding the current region. */
# 1479|   		if (info->region_start > info->erase_start) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def23]
flashrom-1.4.0/linux_mtd.c:62:22: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(__builtin_alloca_with_align(46, 8), "r")’
flashrom-1.4.0/linux_mtd.c:56:19: acquire_resource: opened here
flashrom-1.4.0/linux_mtd.c:56:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/linux_mtd.c:61:9: branch_false: ...to here
flashrom-1.4.0/linux_mtd.c:63:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/linux_mtd.c:64:17: throw: if ‘print’ throws an exception...
flashrom-1.4.0/linux_mtd.c:62:22: danger: ‘fopen(__builtin_alloca_with_align(46, 8), "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   60|   
#   61|   	clearerr(fp);
#   62|-> 	bytes_read = fread(buf, 1, (size_t)len, fp);
#   63|   	if (!feof(fp) && ferror(fp)) {
#   64|   		msg_perr("Error occurred when reading %s\n", path);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def24]
flashrom-1.4.0/linux_mtd.c:62:22: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(__builtin_alloca_with_align(46, 8), "r")’
flashrom-1.4.0/linux_mtd.c:56:19: acquire_memory: allocated here
flashrom-1.4.0/linux_mtd.c:56:12: branch_false: following ‘false’ branch...
flashrom-1.4.0/linux_mtd.c:61:9: branch_false: ...to here
flashrom-1.4.0/linux_mtd.c:63:12: branch_true: following ‘true’ branch...
flashrom-1.4.0/linux_mtd.c:64:17: throw: if ‘print’ throws an exception...
flashrom-1.4.0/linux_mtd.c:62:22: danger: ‘fopen(__builtin_alloca_with_align(46, 8), "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   60|   
#   61|   	clearerr(fp);
#   62|-> 	bytes_read = fread(buf, 1, (size_t)len, fp);
#   63|   	if (!feof(fp) && ferror(fp)) {
#   64|   		msg_perr("Error occurred when reading %s\n", path);

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-64.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-nameflashrom-1.6.0-2.fc44
diffbase-store-results-to/tmp/tmpu3ov4bbv/flashrom-1.6.0-2.fc44.tar.xz
diffbase-time-created2026-01-08 16:08:42
diffbase-time-finished2026-01-08 16:10:10
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpu3ov4bbv/flashrom-1.6.0-2.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpu3ov4bbv/flashrom-1.6.0-2.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-64.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-nameflashrom-1.4.0-3.fc43
store-results-to/tmp/tmpcgj3gp49/flashrom-1.4.0-3.fc43.tar.xz
time-created2026-01-08 16:06:19
time-finished2026-01-08 16:08:11
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpcgj3gp49/flashrom-1.4.0-3.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpcgj3gp49/flashrom-1.4.0-3.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9