Newly introduced findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
LVM2.2.03.36/lib/device/bcache.c:448:17: warning[-Wanalyzer-malloc-leak]: leak of ‘io’
LVM2.2.03.36/lib/device/bcache.c:439:30: acquire_memory: allocated here
LVM2.2.03.36/lib/device/bcache.c:440:12: branch_false: following ‘false’ branch (when ‘io’ is non-NULL)...
LVM2.2.03.36/lib/device/bcache.c:445:9: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:447:12: branch_true: following ‘true’ branch (when ‘off == -1’)...
LVM2.2.03.36/lib/device/bcache.c:448:17: branch_true: ...to here
LVM2.2.03.36/lib/device/bcache.c:448:17: danger: ‘io’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  446|   	off = lseek(_fd_table[di], where, SEEK_SET);
#  447|   	if (off == (off_t) -1) {
#  448|-> 		log_warn("Device seek error %d for offset %llu", errno, (unsigned long long)where);
#  449|   		free(io);
#  450|   		return false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
LVM2.2.03.36/lib/device/bcache.c:453:17: warning[-Wanalyzer-malloc-leak]: leak of ‘io’
LVM2.2.03.36/lib/device/bcache.c:439:30: acquire_memory: allocated here
LVM2.2.03.36/lib/device/bcache.c:440:12: branch_false: following ‘false’ branch (when ‘io’ is non-NULL)...
LVM2.2.03.36/lib/device/bcache.c:445:9: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:447:12: branch_false: following ‘false’ branch (when ‘off != -1’)...
LVM2.2.03.36/lib/device/bcache.c:452:12: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:452:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:453:17: branch_true: ...to here
LVM2.2.03.36/lib/device/bcache.c:453:17: danger: ‘io’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  451|   	}
#  452|   	if (off != (off_t) where) {
#  453|-> 		log_warn("Device seek failed for offset %llu", (unsigned long long)where);
#  454|   		free(io);
#  455|   		return false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
LVM2.2.03.36/lib/device/bcache.c:469:25: warning[-Wanalyzer-malloc-leak]: leak of ‘io’
LVM2.2.03.36/lib/device/bcache.c:439:30: acquire_memory: allocated here
LVM2.2.03.36/lib/device/bcache.c:440:12: branch_false: following ‘false’ branch (when ‘io’ is non-NULL)...
LVM2.2.03.36/lib/device/bcache.c:445:9: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:447:12: branch_false: following ‘false’ branch (when ‘off != -1’)...
LVM2.2.03.36/lib/device/bcache.c:452:12: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:452:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/bcache.c:461:12: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:461:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:468:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:469:25: branch_true: ...to here
LVM2.2.03.36/lib/device/bcache.c:469:25: danger: ‘io’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  467|   
#  468|   		if (offset > _last_byte_offset) {
#  469|-> 			log_error("Limit write at %llu len %llu beyond last byte %llu",
#  470|   				  (unsigned long long)offset,
#  471|   				  (unsigned long long)nbytes,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
LVM2.2.03.36/lib/device/bcache.c:491:41: warning[-Wanalyzer-malloc-leak]: leak of ‘io’
LVM2.2.03.36/lib/device/bcache.c:439:30: acquire_memory: allocated here
LVM2.2.03.36/lib/device/bcache.c:440:12: branch_false: following ‘false’ branch (when ‘io’ is non-NULL)...
LVM2.2.03.36/lib/device/bcache.c:445:9: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:447:12: branch_false: following ‘false’ branch (when ‘off != -1’)...
LVM2.2.03.36/lib/device/bcache.c:452:12: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:452:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/bcache.c:461:12: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:461:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:468:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/bcache.c:477:21: branch_false: ...to here
LVM2.2.03.36/lib/device/bcache.c:477:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:478:25: branch_true: ...to here
LVM2.2.03.36/lib/device/bcache.c:480:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:481:33: branch_true: ...to here
LVM2.2.03.36/lib/device/bcache.c:490:36: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/device/bcache.c:491:41: branch_true: ...to here
LVM2.2.03.36/lib/device/bcache.c:491:41: danger: ‘io’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  489|   				 */
#  490|   				if (limit_nbytes + extra_nbytes > nbytes) {
#  491|-> 					log_warn("Skip extending write at %llu len %llu limit %llu extra %llu sector_size %llu",
#  492|   						 (unsigned long long)offset,
#  493|   						 (unsigned long long)nbytes,

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
LVM2.2.03.36/lib/device/nvme.c:187:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(dev_name(dev), 0)’
LVM2.2.03.36/lib/device/nvme.c:177:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:180:19: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:182:19: acquire_resource: opened here
LVM2.2.03.36/lib/device/nvme.c:182:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:187:13: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:187:13: danger: ‘open(dev_name(dev), 0)’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  185|   	}
#  186|   
#  187|-> 	if (nvme_get_nsid(fd, &nsid)) {
#  188|   		log_print("dev_read_nvme_wwids nvme_get_nsid error %d %s", errno, devpath);
#  189|   		goto out;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
LVM2.2.03.36/lib/device/nvme.c:318:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(dev_name(dev), 0)’
LVM2.2.03.36/lib/device/nvme.c:313:19: acquire_resource: opened here
LVM2.2.03.36/lib/device/nvme.c:313:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:318:13: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:318:13: danger: ‘open(dev_name(dev), 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  316|   	}
#  317|   
#  318|-> 	if (nvme_get_nsid(fd, &nsid)) {
#  319|   		log_error("dev_read_reservation %s nvme_get_nsid error %d", devname, errno);
#  320|   		goto out;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
LVM2.2.03.36/lib/device/nvme.c:335:20: warning[-Wanalyzer-malloc-leak]: leak of ‘status’
LVM2.2.03.36/lib/device/nvme.c:313:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:318:13: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:318:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:323:24: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:323:24: acquire_memory: allocated here
LVM2.2.03.36/lib/device/nvme.c:323:12: branch_false: following ‘false’ branch (when ‘status’ is non-NULL)...
LVM2.2.03.36/lib/device/nvme.c:326:9: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:335:20: danger: ‘status’ leaks here; was allocated at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
#  333|   	args.result = NULL;
#  334|   
#  335|-> 	if ((err = nvme_resv_report(&args))) {
#  336|   		log_error("dev_read_reservation %s error %d", devname, err);
#  337|   		goto out;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def8]
LVM2.2.03.36/lib/device/nvme.c:402:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(dev_name(dev), 0)’
LVM2.2.03.36/lib/device/nvme.c:397:19: acquire_resource: opened here
LVM2.2.03.36/lib/device/nvme.c:397:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:402:13: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:402:13: danger: ‘open(dev_name(dev), 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  400|   	}
#  401|   
#  402|-> 	if (nvme_get_nsid(fd, &nsid)) {
#  403|   		if (may_fail)
#  404|   			log_debug("dev_find_key_nvme %s nvme_get_nsid error %d", devname, errno);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
LVM2.2.03.36/lib/device/nvme.c:422:20: warning[-Wanalyzer-malloc-leak]: leak of ‘status’
LVM2.2.03.36/lib/device/nvme.c:397:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:402:13: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:402:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/nvme.c:410:24: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:410:24: acquire_memory: allocated here
LVM2.2.03.36/lib/device/nvme.c:410:12: branch_false: following ‘false’ branch (when ‘status’ is non-NULL)...
LVM2.2.03.36/lib/device/nvme.c:413:9: branch_false: ...to here
LVM2.2.03.36/lib/device/nvme.c:422:20: danger: ‘status’ leaks here; was allocated at [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
#  420|   	args.result = NULL;
#  421|   
#  422|-> 	if ((err = nvme_resv_report(&args))) {
#  423|   		if (may_fail)
#  424|   			log_debug("dev_find_key_nvme %s error %d", devname, err);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
LVM2.2.03.36/lib/device/persist.c:288:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&path, "r")’
LVM2.2.03.36/lib/device/persist.c:1001:12: enter_function: entry to ‘get_our_key_sanlock_start’
LVM2.2.03.36/lib/device/persist.c:1015:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/persist.c:1021:14: branch_false: ...to here
LVM2.2.03.36/lib/device/persist.c:1021:14: call_function: calling ‘read_key_file’ from ‘get_our_key_sanlock_start’
#  286|   		p = strchr(line, ' ') + 1;
#  287|   
#  288|-> 		dm_strncpy(buf_key, p, sizeof(buf_key));
#  289|   		break;
#  290|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
LVM2.2.03.36/lib/device/persist.c:288:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&path, "r")’
LVM2.2.03.36/lib/device/persist.c:1001:12: enter_function: entry to ‘get_our_key_sanlock_start’
LVM2.2.03.36/lib/device/persist.c:1015:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/lib/device/persist.c:1021:14: branch_false: ...to here
LVM2.2.03.36/lib/device/persist.c:1021:14: call_function: calling ‘read_key_file’ from ‘get_our_key_sanlock_start’
#  286|   		p = strchr(line, ' ') + 1;
#  287|   
#  288|-> 		dm_strncpy(buf_key, p, sizeof(buf_key));
#  289|   		break;
#  290|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
LVM2.2.03.36/lib/raid/raid.c:722:21: warning[-Wanalyzer-malloc-leak]: leak of ‘_init_raid_segtype(cmd, & _raid_types[i], get_monitor_dso_path(cmd, 285), monitored)’
LVM2.2.03.36/lib/raid/raid.c:699:5: enter_function: entry to ‘init_raid_segtypes’
LVM2.2.03.36/lib/raid/raid.c:721:21: branch_true: following ‘true’ branch (when ‘i != 21’)...
LVM2.2.03.36/lib/raid/raid.c:722:32: branch_true: ...to here
LVM2.2.03.36/lib/raid/raid.c:722:32: call_function: calling ‘_init_raid_segtype’ from ‘init_raid_segtypes’
LVM2.2.03.36/lib/raid/raid.c:722:32: return_function: returning to ‘init_raid_segtypes’ from ‘_init_raid_segtype’
LVM2.2.03.36/lib/raid/raid.c:722:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/lib/raid/raid.c:723:22: branch_true: ...to here
LVM2.2.03.36/lib/raid/raid.c:722:21: danger: ‘_init_raid_segtype(cmd, & _raid_types[i], get_monitor_dso_path(cmd, 285), monitored)’ leaks here; was allocated at [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
#  720|   
#  721|   	for (i = 0; i < DM_ARRAY_SIZE(_raid_types); ++i)
#  722|-> 		if ((segtype = _init_raid_segtype(cmd, &_raid_types[i], dso, monitored)) &&
#  723|   		    !lvm_register_segtype(seglib, segtype)) {
#  724|   			/* segtype is already destroyed */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
LVM2.2.03.36/tools/pvck.c:967:41: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:959:22: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:959:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:965:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:966:36: branch_true: following ‘true’ branch (when ‘vgname’ is NULL)...
LVM2.2.03.36/tools/pvck.c:967:41: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:967:41: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/2)
#  965|   			if (cft->root && cft->root->key) {
#  966|   				if (!(vgname = strdup(cft->root->key))) {
#  967|-> 					log_error("Failed to allocate vgname.");
#  968|   					goto out;
#  969|   				}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
LVM2.2.03.36/tools/pvck.c:972:30: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:959:22: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:959:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:965:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:965:42: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:971:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:971:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:972:30: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/2)
#  970|   			}
#  971|   			if ((cft->root && cft->root->child) &&
#  972|-> 			    !dm_config_get_uint32(cft->root->child, "seqno", &seqno)) {
#  973|   				log_print("CHECK: failed to parse seqno text at %llu",
#  974|   					  (unsigned long long)(mda_offset + meta_offset));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
LVM2.2.03.36/tools/pvck.c:972:30: warning[-Wanalyzer-malloc-leak]: leak of ‘vgname’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:959:22: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:959:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:965:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:966:48: acquire_memory: allocated here
LVM2.2.03.36/tools/pvck.c:966:36: branch_false: following ‘false’ branch (when ‘vgname’ is non-NULL)...
LVM2.2.03.36/tools/pvck.c:971:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:971:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:972:30: danger: ‘vgname’ leaks here; was allocated at [(17)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/16)
#  970|   			}
#  971|   			if ((cft->root && cft->root->child) &&
#  972|-> 			    !dm_config_get_uint32(cft->root->child, "seqno", &seqno)) {
#  973|   				log_print("CHECK: failed to parse seqno text at %llu",
#  974|   					  (unsigned long long)(mda_offset + meta_offset));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
LVM2.2.03.36/tools/pvck.c:973:33: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:959:22: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:959:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:965:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:965:42: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:971:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:971:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:973:33: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/29/codeFlows/0/threadFlows/0/locations/2)
#  971|   			if ((cft->root && cft->root->child) &&
#  972|   			    !dm_config_get_uint32(cft->root->child, "seqno", &seqno)) {
#  973|-> 				log_print("CHECK: failed to parse seqno text at %llu",
#  974|   					  (unsigned long long)(mda_offset + meta_offset));
#  975|   				bad++;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
LVM2.2.03.36/tools/pvck.c:973:33: warning[-Wanalyzer-malloc-leak]: leak of ‘vgname’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:959:22: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:959:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:965:29: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:965:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:966:48: acquire_memory: allocated here
LVM2.2.03.36/tools/pvck.c:966:36: branch_false: following ‘false’ branch (when ‘vgname’ is non-NULL)...
LVM2.2.03.36/tools/pvck.c:971:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:971:28: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:973:33: danger: ‘vgname’ leaks here; was allocated at [(17)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/16)
#  971|   			if ((cft->root && cft->root->child) &&
#  972|   			    !dm_config_get_uint32(cft->root->child, "seqno", &seqno)) {
#  973|-> 				log_print("CHECK: failed to parse seqno text at %llu",
#  974|   					  (unsigned long long)(mda_offset + meta_offset));
#  975|   				bad++;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
LVM2.2.03.36/tools/pvck.c:991:17: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:956:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:982:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:983:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: following ‘false’ branch (when ‘vgname’ is NULL)...
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:987:12: branch_false: following ‘false’ branch (when ‘print_metadata != 0’)...
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:990:12: branch_true: following ‘true’ branch (when ‘tofile’ is NULL)...
LVM2.2.03.36/tools/pvck.c:991:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:991:17: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/2)
#  989|   
#  990|   	if (!tofile) {
#  991|-> 		log_print("---");
#  992|   		printf("%s\n", meta_buf);
#  993|   		log_print("---");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
LVM2.2.03.36/tools/pvck.c:993:17: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:956:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:982:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:983:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: following ‘false’ branch (when ‘vgname’ is NULL)...
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:987:12: branch_false: following ‘false’ branch (when ‘print_metadata != 0’)...
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:990:12: branch_true: following ‘true’ branch (when ‘tofile’ is NULL)...
LVM2.2.03.36/tools/pvck.c:991:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:993:17: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/33/codeFlows/0/threadFlows/0/locations/2)
#  991|   		log_print("---");
#  992|   		printf("%s\n", meta_buf);
#  993|-> 		log_print("---");
#  994|   	} else {
#  995|   		FILE *fp;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
LVM2.2.03.36/tools/pvck.c:997:25: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:956:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:982:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:983:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: following ‘false’ branch (when ‘vgname’ is NULL)...
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:987:12: branch_false: following ‘false’ branch (when ‘print_metadata != 0’)...
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: following ‘false’ branch (when ‘tofile’ is non-NULL)...
LVM2.2.03.36/tools/pvck.c:996:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:996:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:997:25: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:997:25: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/2)
#  995|   		FILE *fp;
#  996|   		if (!(fp = fopen(tofile, "wx"))) {
#  997|-> 			log_error("Failed to create file %s", tofile);
#  998|   			goto out;
#  999|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
LVM2.2.03.36/tools/pvck.c:1003:21: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:956:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:982:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:983:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: following ‘false’ branch (when ‘vgname’ is NULL)...
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:987:12: branch_false: following ‘false’ branch (when ‘print_metadata != 0’)...
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: following ‘false’ branch (when ‘tofile’ is non-NULL)...
LVM2.2.03.36/tools/pvck.c:996:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:996:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:1001:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:1003:21: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/37/codeFlows/0/threadFlows/0/locations/2)
# 1001|   		fprintf(fp, "%s", meta_buf);
# 1002|   
# 1003|-> 		if (fflush(fp))
# 1004|   			stack;
# 1005|   		if (fclose(fp))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
LVM2.2.03.36/tools/pvck.c:1004:25: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, meta_size + 1)’
LVM2.2.03.36/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:26: call_function: inlined call to ‘zalloc’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.36/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.36/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:955:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:956:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:982:12: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:983:17: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: following ‘false’ branch (when ‘vgname’ is NULL)...
LVM2.2.03.36/tools/pvck.c:983:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:987:12: branch_false: following ‘false’ branch (when ‘print_metadata != 0’)...
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:990:12: branch_false: following ‘false’ branch (when ‘tofile’ is non-NULL)...
LVM2.2.03.36/tools/pvck.c:996:28: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:996:20: branch_false: following ‘false’ branch...
LVM2.2.03.36/tools/pvck.c:1001:17: branch_false: ...to here
LVM2.2.03.36/tools/pvck.c:1003:20: branch_true: following ‘true’ branch...
LVM2.2.03.36/tools/pvck.c:1004:25: branch_true: ...to here
LVM2.2.03.36/tools/pvck.c:1004:25: danger: ‘calloc(1, meta_size + 1)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/40/codeFlows/0/threadFlows/0/locations/2)
# 1002|   
# 1003|   		if (fflush(fp))
# 1004|-> 			stack;
# 1005|   		if (fclose(fp))
# 1006|   			stack;

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.90.0
diffbase-analyzer-version-cppcheck2.18.3
diffbase-analyzer-version-gcc15.2.1
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-43.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-gcc-latest-x86_64
diffbase-project-namelvm2-2.03.34-2.fc43
diffbase-store-results-to/tmp/tmpr074456d/lvm2-2.03.34-2.fc43.tar.xz
diffbase-time-created2025-10-28 19:21:32
diffbase-time-finished2025-10-28 19:26:18
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpr074456d/lvm2-2.03.34-2.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpr074456d/lvm2-2.03.34-2.fc43.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-43.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-gcc-latest-x86_64
project-namelvm2-2.03.36-1.fc44
store-results-to/tmp/tmpbfyfzxzt/lvm2-2.03.36-1.fc44.tar.xz
time-created2025-10-28 19:27:03
time-finished2025-10-28 19:31:16
titleNewly introduced findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpbfyfzxzt/lvm2-2.03.36-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpbfyfzxzt/lvm2-2.03.36-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9