libnvme-1.16.1-1.fc44

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libnvme-1.16.1/examples/telemetry-listen.c:34:13: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
#   32|   {
#   33|   	char buf[0x1000];
#   34|-> 	if (snprintf(buf, sizeof(buf), "%s/uevent", nvme_ctrl_get_sysfs_dir(c)) < 0)
#   35|   		return -1;
#   36|   	return open(buf, O_RDONLY);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libnvme-1.16.1/examples/telemetry-listen.c:36:16: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
#   34|   	if (snprintf(buf, sizeof(buf), "%s/uevent", nvme_ctrl_get_sysfs_dir(c)) < 0)
#   35|   		return -1;
#   36|-> 	return open(buf, O_RDONLY);
#   37|   }
#   38|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
libnvme-1.16.1/examples/telemetry-listen.c:48:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   46|   
#   47|   	/* Clear the log (rae == false) at the end to see new telemetry events later */
#   48|-> 	ret = nvme_get_ctrl_telemetry(nvme_ctrl_get_fd(c), false, &log, NVME_TELEMETRY_DA_3, &log_size);
#   49|   	if (ret)
#   50|   		return;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libnvme-1.16.1/examples/telemetry-listen.c:48:15: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   46|   
#   47|   	/* Clear the log (rae == false) at the end to see new telemetry events later */
#   48|-> 	ret = nvme_get_ctrl_telemetry(nvme_ctrl_get_fd(c), false, &log, NVME_TELEMETRY_DA_3, &log_size);
#   49|   	if (ret)
#   50|   		return;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
libnvme-1.16.1/examples/telemetry-listen.c:97:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   95|   		lid = (aen >> 16) & 0xff;
#   96|   
#   97|-> 		printf("%s: aen type:%x info:%x lid:%d\n",
#   98|   			nvme_ctrl_get_name(c), type, info, lid);
#   99|   		if (type == NVME_AER_NOTICE &&

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
libnvme-1.16.1/examples/telemetry-listen.c:97:17: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   95|   		lid = (aen >> 16) & 0xff;
#   96|   
#   97|-> 		printf("%s: aen type:%x info:%x lid:%d\n",
#   98|   			nvme_ctrl_get_name(c), type, info, lid);
#   99|   		if (type == NVME_AER_NOTICE &&

Error: GCC_ANALYZER_WARNING (CWE-126): [#def7]
libnvme-1.16.1/examples/telemetry-listen.c:110:17: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#  108|   
#  109|   	for (i = 0; i < nr; i++)
#  110|-> 		check_telemetry(e[i].c, e[i].uevent_fd);
#  111|   
#  112|   	while (1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libnvme-1.16.1/examples/telemetry-listen.c:113:23: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#  111|   
#  112|   	while (1) {
#  113|-> 		ret = select(nr, fds, NULL, NULL, NULL);
#  114|   		if (ret < 0)
#  115|   			return;

Error: GCC_ANALYZER_WARNING (CWE-126): [#def9]
libnvme-1.16.1/examples/telemetry-listen.c:118:30: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#  116|   
#  117|   		for (i = 0; i < nr; i++) {
#  118|-> 			if (!FD_ISSET(e[i].uevent_fd, fds))
#  119|   				continue;
#  120|   			check_telemetry(e[i].c, e[i].uevent_fd);

Error: GCC_ANALYZER_WARNING (CWE-126): [#def10]
libnvme-1.16.1/examples/telemetry-listen.c:120:25: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: following ‘false’ branch (when ‘h’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:164:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#  118|   			if (!FD_ISSET(e[i].uevent_fd, fds))
#  119|   				continue;
#  120|-> 			check_telemetry(e[i].c, e[i].uevent_fd);
#  121|   		}
#  122|   	}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def11]
libnvme-1.16.1/examples/telemetry-listen.c:149:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: following ‘false’ branch (when ‘s’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: throw: if ‘nvme_next_host’ throws an exception...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: danger: leaks here; was opened at [(10)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/9)
#  147|   	i = 0;
#  148|   
#  149|-> 	nvme_for_each_host(r, h) {
#  150|   		nvme_for_each_subsystem(h, s) {
#  151|   			nvme_subsystem_for_each_ctrl(s, c) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
libnvme-1.16.1/examples/telemetry-listen.c:149:9: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: throw: if ‘nvme_first_host’ throws an exception...
libnvme-1.16.1/examples/telemetry-listen.c:149:9: danger: ‘e’ leaks here; was allocated at [(3)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/2)
#  147|   	i = 0;
#  148|   
#  149|-> 	nvme_for_each_host(r, h) {
#  150|   		nvme_for_each_subsystem(h, s) {
#  151|   			nvme_subsystem_for_each_ctrl(s, c) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def13]
libnvme-1.16.1/examples/telemetry-listen.c:150:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: throw: if ‘nvme_next_subsystem’ throws an exception...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: danger: leaks here; was opened at [(10)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/9)
#  148|   
#  149|   	nvme_for_each_host(r, h) {
#  150|-> 		nvme_for_each_subsystem(h, s) {
#  151|   			nvme_subsystem_for_each_ctrl(s, c) {
#  152|   				int fd = open_uevent(c);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
libnvme-1.16.1/examples/telemetry-listen.c:150:17: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: throw: if ‘nvme_first_subsystem’ throws an exception...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: danger: ‘e’ leaks here; was allocated at [(3)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/2)
#  148|   
#  149|   	nvme_for_each_host(r, h) {
#  150|-> 		nvme_for_each_subsystem(h, s) {
#  151|   			nvme_subsystem_for_each_ctrl(s, c) {
#  152|   				int fd = open_uevent(c);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def15]
libnvme-1.16.1/examples/telemetry-listen.c:151:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.16.1/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.16.1/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.16.1/examples/telemetry-listen.c:151:25: throw: if ‘nvme_subsystem_next_ctrl’ throws an exception...
libnvme-1.16.1/examples/telemetry-listen.c:151:25: danger: leaks here; was opened at [(10)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/9)
#  149|   	nvme_for_each_host(r, h) {
#  150|   		nvme_for_each_subsystem(h, s) {
#  151|-> 			nvme_subsystem_for_each_ctrl(s, c) {
#  152|   				int fd = open_uevent(c);
#  153|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libnvme-1.16.1/examples/telemetry-listen.c:151:25: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:151:25: throw: if ‘nvme_subsystem_first_ctrl’ throws an exception...
libnvme-1.16.1/examples/telemetry-listen.c:151:25: danger: ‘e’ leaks here; was allocated at [(3)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/2)
#  149|   	nvme_for_each_host(r, h) {
#  150|   		nvme_for_each_subsystem(h, s) {
#  151|-> 			nvme_subsystem_for_each_ctrl(s, c) {
#  152|   				int fd = open_uevent(c);
#  153|   

Error: CPPCHECK_WARNING (CWE-476): [#def17]
libnvme-1.16.1/examples/telemetry-listen.c:157: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: e
#  155|   					continue;
#  156|   				FD_SET(fd, &fds);
#  157|-> 				e[i].uevent_fd = fd;
#  158|   				e[i].c = c;
#  159|   				i++;

Error: GCC_ANALYZER_WARNING (CWE-122): [#def18]
libnvme-1.16.1/examples/telemetry-listen.c:157:33: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:157:33: danger: out-of-bounds write from byte 8 till byte 11 but region ends at byte 0
#  155|   					continue;
#  156|   				FD_SET(fd, &fds);
#  157|-> 				e[i].uevent_fd = fd;
#  158|   				e[i].c = c;
#  159|   				i++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
libnvme-1.16.1/examples/telemetry-listen.c:157:33: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘e’
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:145:13: acquire_memory: this call could return NULL
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:157:33: danger: ‘e + (long unsigned int)i * 16’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/2)
#  155|   					continue;
#  156|   				FD_SET(fd, &fds);
#  157|-> 				e[i].uevent_fd = fd;
#  158|   				e[i].c = c;
#  159|   				i++;

Error: CPPCHECK_WARNING (CWE-476): [#def20]
libnvme-1.16.1/examples/telemetry-listen.c:158: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: e
#  156|   				FD_SET(fd, &fds);
#  157|   				e[i].uevent_fd = fd;
#  158|-> 				e[i].c = c;
#  159|   				i++;
#  160|   			}

Error: GCC_ANALYZER_WARNING (CWE-122): [#def21]
libnvme-1.16.1/examples/telemetry-listen.c:158:33: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
libnvme-1.16.1/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.16.1/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.16.1/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.16.1/examples/telemetry-listen.c:158:33: danger: out-of-bounds write from byte 0 till byte 7 but region ends at byte 0
#  156|   				FD_SET(fd, &fds);
#  157|   				e[i].uevent_fd = fd;
#  158|-> 				e[i].c = c;
#  159|   				i++;
#  160|   			}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:724:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘iter’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:3269:1: enter_function: entry to ‘SWIG_Python_TypeQuery’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:3275:6: branch_false: following ‘false’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:3278:37: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:3278:37: call_function: calling ‘SWIG_Python_GetModule’ from ‘SWIG_Python_TypeQuery’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:3278:37: return_function: returning to ‘SWIG_Python_TypeQuery’ from ‘SWIG_Python_GetModule’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:3279:18: call_function: calling ‘SWIG_TypeQueryModule’ from ‘SWIG_Python_TypeQuery’
#  722|     swig_module_info *iter = start;
#  723|     do {
#  724|->     if (iter->size) {
#  725|         size_t l = 0;
#  726|         size_t r = iter->size - 1;

Error: CPPCHECK_WARNING (CWE-457): [#def23]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:872: warning[uninitvar]: Uninitialized variable: buff
#  870|       *r = 0;
#  871|     }
#  872|->   return buff;
#  873|   }
#  874|   

Error: CPPCHECK_WARNING (CWE-476): [#def24]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1901: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 1899|       SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
# 1900|       /* the klass element */
# 1901|->     data->klass = obj;
# 1902|       SWIG_Py_INCREF(data->klass);
# 1903|       /* the newraw method and newargs arguments used to create a new raw instance */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def25]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1901:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: this call could return NULL
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1901:5: danger: ‘data’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
# 1899|       SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
# 1900|       /* the klass element */
# 1901|->     data->klass = obj;
# 1902|       SWIG_Py_INCREF(data->klass);
# 1903|       /* the newraw method and newargs arguments used to create a new raw instance */

Error: CPPCHECK_WARNING (CWE-476): [#def26]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1902: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 1900|       /* the klass element */
# 1901|       data->klass = obj;
# 1902|->     SWIG_Py_INCREF(data->klass);
# 1903|       /* the newraw method and newargs arguments used to create a new raw instance */
# 1904|       if (PyClass_Check(obj)) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def27]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:9: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: allocated here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:9: throw: if ‘PyObject_IsInstance’ throws an exception...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:9: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
# 1902|       SWIG_Py_INCREF(data->klass);
# 1903|       /* the newraw method and newargs arguments used to create a new raw instance */
# 1904|->     if (PyClass_Check(obj)) {
# 1905|         data->newraw = 0;
# 1906|         SWIG_Py_INCREF(obj);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def28]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1909:22: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: allocated here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:8: branch_false: following ‘false’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1909:22: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1909:22: throw: if ‘PyObject_GetAttrString’ throws an exception...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1909:22: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
# 1907|         data->newargs = obj;
# 1908|       } else {
# 1909|->       data->newraw = PyObject_GetAttrString(data->klass, "__new__");
# 1910|         if (data->newraw) {
# 1911|           data->newargs = PyTuple_New(1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1911:25: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: allocated here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:8: branch_false: following ‘false’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1909:22: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1910:10: branch_true: following ‘true’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1911:25: branch_true: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1911:25: throw: if ‘PyTuple_New’ throws an exception...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1911:25: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
# 1909|         data->newraw = PyObject_GetAttrString(data->klass, "__new__");
# 1910|         if (data->newraw) {
# 1911|->         data->newargs = PyTuple_New(1);
# 1912|           if (data->newargs) {
# 1913|             SWIG_Py_INCREF(obj);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def30]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1927:21: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1894:1: enter_function: entry to ‘SwigPyClientData_New’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: allocated here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:8: branch_true: following ‘true’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1905:7: branch_true: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1906:7: call_function: inlined call to ‘Py_INCREF’ from ‘SwigPyClientData_New’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1907:7: branch_true: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1927:21: throw: if ‘PyObject_GetAttrString’ throws an exception...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1927:21: danger: ‘data’ leaks here; was allocated at [(4)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/3)
# 1925|       }
# 1926|       /* the destroy method, aka as the C++ delete method */
# 1927|->     data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
# 1928|       if (PyErr_Occurred()) {
# 1929|         PyErr_Clear();

Error: GCC_ANALYZER_WARNING (CWE-401): [#def31]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1928:9: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: allocated here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:8: branch_true: following ‘true’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1905:7: branch_true: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1928:9: throw: if ‘PyErr_Occurred’ throws an exception...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1928:9: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/2)
# 1926|       /* the destroy method, aka as the C++ delete method */
# 1927|       data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
# 1928|->     if (PyErr_Occurred()) {
# 1929|         PyErr_Clear();
# 1930|         data->destroy = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def32]
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1929:7: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1896:6: branch_false: following ‘false’ branch (when ‘obj’ is non-NULL)...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: branch_false: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1899:50: acquire_memory: allocated here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1904:8: branch_true: following ‘true’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1905:7: branch_true: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1928:8: branch_true: following ‘true’ branch...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1929:7: branch_true: ...to here
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1929:7: throw: if ‘PyErr_Clear’ throws an exception...
libnvme-1.16.1/redhat-linux-build/libnvme/nvme_wrap.c:1929:7: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/2)
# 1927|       data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
# 1928|       if (PyErr_Occurred()) {
# 1929|->       PyErr_Clear();
# 1930|         data->destroy = 0;
# 1931|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def33]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.16.1/src/nvme/tree.c:2807:18: enter_function: entry to ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2816:12: branch_false: following ‘false’ branch (when ‘n’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:2821:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2822:12: branch_false: following ‘false’ branch (when ‘head’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:2828:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2831:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2839:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2840:12: branch_true: following ‘true’ branch (when ‘ret == 0’)...
libnvme-1.16.1/src/nvme/tree.c:2841:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:2848:19: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:2850:9: call_function: calling ‘nvme_ns_set_generic_name’ from ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2850:9: return_function: returning to ‘nvme_ns_open’ from ‘nvme_ns_set_generic_name’
libnvme-1.16.1/src/nvme/tree.c:2852:13: call_function: calling ‘nvme_ns_init’ from ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2813:30: call_function: inlined call to ‘freep’ from ‘nvme_ns_open’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def34]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘head’
libnvme-1.16.1/src/nvme/tree.c:2807:18: enter_function: entry to ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2816:12: branch_false: following ‘false’ branch (when ‘n’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:2821:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2821:16: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:2822:12: branch_false: following ‘false’ branch (when ‘head’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:2828:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2831:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2839:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2840:12: branch_true: following ‘true’ branch (when ‘ret == 0’)...
libnvme-1.16.1/src/nvme/tree.c:2841:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:2850:9: call_function: calling ‘nvme_ns_set_generic_name’ from ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2850:9: return_function: returning to ‘nvme_ns_open’ from ‘nvme_ns_set_generic_name’
libnvme-1.16.1/src/nvme/tree.c:2852:13: call_function: calling ‘nvme_ns_init’ from ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2813:30: call_function: inlined call to ‘freep’ from ‘nvme_ns_open’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘n’
libnvme-1.16.1/src/nvme/tree.c:2807:18: enter_function: entry to ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2815:13: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:2816:12: branch_false: following ‘false’ branch (when ‘n’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:2821:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2822:12: branch_false: following ‘false’ branch (when ‘head’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:2828:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2831:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2839:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2840:12: branch_true: following ‘true’ branch (when ‘ret == 0’)...
libnvme-1.16.1/src/nvme/tree.c:2841:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:2850:9: call_function: calling ‘nvme_ns_set_generic_name’ from ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2850:9: return_function: returning to ‘nvme_ns_open’ from ‘nvme_ns_set_generic_name’
libnvme-1.16.1/src/nvme/tree.c:2852:13: call_function: calling ‘nvme_ns_init’ from ‘nvme_ns_open’
libnvme-1.16.1/src/nvme/tree.c:2813:30: call_function: inlined call to ‘freep’ from ‘nvme_ns_open’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def36]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘digest’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def37]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘dim’
libnvme-1.16.1/src/nvme/fabrics.c:1633:23: throw: if ‘nvme_ctrl_get_fd’ throws an exception...
libnvme-1.16.1/src/nvme/fabrics.c:1625:46: call_function: inlined call to ‘freep’ from ‘nvmf_dim’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def38]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘grpid’
libnvme-1.16.1/src/nvme/tree.c:2310:6: enter_function: entry to ‘nvme_rescan_ctrl’
libnvme-1.16.1/src/nvme/tree.c:2312:25: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/tree.c:2313:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2315:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2315:9: call_function: calling ‘nvme_ctrl_scan_namespaces’ from ‘nvme_rescan_ctrl’
libnvme-1.16.1/src/nvme/tree.c:2315:9: return_function: returning to ‘nvme_rescan_ctrl’ from ‘nvme_ctrl_scan_namespaces’
libnvme-1.16.1/src/nvme/tree.c:2316:9: call_function: calling ‘nvme_ctrl_scan_paths’ from ‘nvme_rescan_ctrl’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def39]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘hkdf_info’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def40]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘hnqn’
libnvme-1.16.1/src/nvme/tree.c:2243:13: enter_function: entry to ‘nvme_scan_ctrl’
libnvme-1.16.1/src/nvme/tree.c:2256:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2261:19: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2264:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2274:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2274:21: call_function: calling ‘nvme_default_host’ from ‘nvme_scan_ctrl’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def41]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘hostid’
libnvme-1.16.1/src/nvme/tree.c:2254:9: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:2246:47: call_function: inlined call to ‘freep’ from ‘nvme_scan_ctrl’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def42]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘id’
libnvme-1.16.1/src/nvme/fabrics.c:1769:14: throw: if ‘__nvme_alloc’ throws an exception...
libnvme-1.16.1/src/nvme/fabrics.c:1766:45: call_function: inlined call to ‘freep’ from ‘nvme_fetch_cntrltype_dctype_from_id’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def43]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘key_data’
libnvme-1.16.1/src/nvme/linux.c:1754:13: enter_function: entry to ‘__nvme_import_tls_key’
libnvme-1.16.1/src/nvme/linux.c:1763:20: call_function: calling ‘nvme_import_tls_key_versioned’ from ‘__nvme_import_tls_key’
libnvme-1.16.1/src/nvme/linux.c:1758:39: call_function: inlined call to ‘freep’ from ‘__nvme_import_tls_key’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def44]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘psk_ctx’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def45]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘str’
libnvme-1.16.1/src/nvme/json.c:211:16: branch_true: following ‘true’ branch (when ‘ret > 0’)...
libnvme-1.16.1/src/nvme/json.c:212:36: branch_true: ...to here
libnvme-1.16.1/src/nvme/json.c:213:20: branch_false: following ‘false’ branch (when ‘str’ is non-NULL)...
libnvme-1.16.1/src/nvme/json.c:215:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/json.c:211:16: branch_false: following ‘false’ branch (when ‘ret <= 0’)...
libnvme-1.16.1/src/nvme/json.c:220:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/json.c:220:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/json.c:223:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/json.c:223:15: throw: if ‘json_tokener_new_ex’ throws an exception...
libnvme-1.16.1/src/nvme/json.c:208:30: call_function: inlined call to ‘freep’ from ‘parse_json’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def46]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘subsys_name’
libnvme-1.16.1/src/nvme/tree.c:2104:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2108:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2108:15: throw: if ‘nvme_ctrl_sysfs_dir’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:2099:30: call_function: inlined call to ‘freep’ from ‘nvme_init_ctrl’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def47]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘target_addr’
libnvme-1.16.1/src/nvme/tree.c:1947:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:1950:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1950:21: throw: if ‘opendir’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:1942:30: call_function: inlined call to ‘freep’ from ‘nvme_ctrl_lookup_phy_slot’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def48]
libnvme-1.16.1/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘transport’
libnvme-1.16.1/src/nvme/tree.c:2154:21: throw: if ‘nvme_get_attr’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:2147:61: call_function: inlined call to ‘freep’ from ‘nvme_ctrl_alloc’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def49]
libnvme-1.16.1/src/nvme/cleanup.h:28:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘stream’
libnvme-1.16.1/src/nvme/fabrics.c:1390:12: enter_function: entry to ‘uuid_from_product_uuid’
libnvme-1.16.1/src/nvme/fabrics.c:1398:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1400:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1402:17: call_function: inlined call to ‘getline’ from ‘uuid_from_product_uuid’
libnvme-1.16.1/src/nvme/fabrics.c:1392:30: call_function: inlined call to ‘cleanup_file’ from ‘uuid_from_product_uuid’
#   26|   #define _cleanup_free_ __cleanup__(freep)
#   27|   
#   28|-> static inline DEFINE_CLEANUP_FUNC(cleanup_file, FILE *, fclose)
#   29|   #define _cleanup_file_ __cleanup__(cleanup_file)
#   30|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def50]
libnvme-1.16.1/src/nvme/cleanup.h:31:15: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.16.1/src/nvme/tree.c:1939:14: enter_function: entry to ‘nvme_ctrl_lookup_phy_slot’
libnvme-1.16.1/src/nvme/tree.c:1947:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:1950:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1951:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:1957:23: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1958:16: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/tree.c:1959:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:1967:28: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:1971:32: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1977:40: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:1943:28: call_function: inlined call to ‘cleanup_dir’ from ‘nvme_ctrl_lookup_phy_slot’
#   29|   #define _cleanup_file_ __cleanup__(cleanup_file)
#   30|   
#   31|-> static inline DEFINE_CLEANUP_FUNC(cleanup_dir, DIR *, closedir)
#   32|   #define _cleanup_dir_ __cleanup__(cleanup_dir)
#   33|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def51]
libnvme-1.16.1/src/nvme/cleanup.h:31:15: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(nvme_dmi_entries_dir())’
libnvme-1.16.1/src/nvme/fabrics.c:1331:13: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/fabrics.c:1332:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1332:12: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1334:22: throw: if ‘readdir’ throws an exception...
libnvme-1.16.1/src/nvme/fabrics.c:1324:28: call_function: inlined call to ‘cleanup_dir’ from ‘uuid_from_dmi_entries’
#   29|   #define _cleanup_file_ __cleanup__(cleanup_file)
#   30|   
#   31|-> static inline DEFINE_CLEANUP_FUNC(cleanup_dir, DIR *, closedir)
#   32|   #define _cleanup_dir_ __cleanup__(cleanup_dir)
#   33|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def52]
libnvme-1.16.1/src/nvme/cleanup.h:31:15: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(nvme_slots_sysfs_dir())’
libnvme-1.16.1/src/nvme/tree.c:1939:14: enter_function: entry to ‘nvme_ctrl_lookup_phy_slot’
libnvme-1.16.1/src/nvme/tree.c:1947:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:1950:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1950:21: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:1951:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:1957:23: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1958:25: throw: if ‘readdir’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:1943:28: call_function: inlined call to ‘cleanup_dir’ from ‘nvme_ctrl_lookup_phy_slot’
#   29|   #define _cleanup_file_ __cleanup__(cleanup_file)
#   30|   
#   31|-> static inline DEFINE_CLEANUP_FUNC(cleanup_dir, DIR *, closedir)
#   32|   #define _cleanup_dir_ __cleanup__(cleanup_dir)
#   33|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def53]
libnvme-1.16.1/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/urandom", 0)’
libnvme-1.16.1/src/nvme/util.c:957:5: enter_function: entry to ‘nvme_uuid_random’
libnvme-1.16.1/src/nvme/util.c:962:13: acquire_resource: opened here
libnvme-1.16.1/src/nvme/util.c:963:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/util.c:965:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/util.c:959:26: call_function: inlined call to ‘cleanup_fd’ from ‘nvme_uuid_random’
#   35|   {
#   36|   	if (*fd >= 0)
#   37|-> 		close(*fd);
#   38|   }
#   39|   #define _cleanup_fd_ __cleanup__(cleanup_fd)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def54]
libnvme-1.16.1/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvme_uuid_ibm_filename(), 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1285:13: acquire_resource: opened here
libnvme-1.16.1/src/nvme/fabrics.c:1286:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1289:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1282:26: call_function: inlined call to ‘cleanup_fd’ from ‘uuid_from_device_tree’
#   35|   {
#   36|   	if (*fd >= 0)
#   37|-> 		close(*fd);
#   38|   }
#   39|   #define _cleanup_fd_ __cleanup__(cleanup_fd)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def55]
libnvme-1.16.1/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvmf_dev, 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1004:13: enter_function: entry to ‘nvmf_connect_disc_entry’
libnvme-1.16.1/src/nvme/fabrics.c:1054:21: call_function: calling ‘nvmf_trtype_str’ from ‘nvmf_connect_disc_entry’
libnvme-1.16.1/src/nvme/fabrics.c:1054:21: return_function: returning to ‘nvmf_connect_disc_entry’ from ‘nvmf_trtype_str’
libnvme-1.16.1/src/nvme/fabrics.c:1061:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1069:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1092:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1098:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1098:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1099:13: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1099:13: call_function: calling ‘__nvmf_supported_options’ from ‘nvmf_connect_disc_entry’
#   35|   {
#   36|   	if (*fd >= 0)
#   37|-> 		close(*fd);
#   38|   }
#   39|   #define _cleanup_fd_ __cleanup__(cleanup_fd)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
libnvme-1.16.1/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.16.1/src/nvme/fabrics.c:1474:14: enter_function: entry to ‘nvmf_read_file’
libnvme-1.16.1/src/nvme/fabrics.c:1481:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1484:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1487:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1489:16: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/fabrics.c:1477:26: call_function: inlined call to ‘cleanup_fd’ from ‘nvmf_read_file’
#   35|   {
#   36|   	if (*fd >= 0)
#   37|-> 		close(*fd);
#   38|   }
#   39|   #define _cleanup_fd_ __cleanup__(cleanup_fd)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def57]
libnvme-1.16.1/src/nvme/fabrics.c:724:12: warning[-Wanalyzer-malloc-leak]: leak of ‘*((struct nvme_root *)r).options’
libnvme-1.16.1/src/nvme/fabrics.c:1004:13: enter_function: entry to ‘nvmf_connect_disc_entry’
libnvme-1.16.1/src/nvme/fabrics.c:1054:21: call_function: calling ‘nvmf_trtype_str’ from ‘nvmf_connect_disc_entry’
libnvme-1.16.1/src/nvme/fabrics.c:1054:21: return_function: returning to ‘nvmf_connect_disc_entry’ from ‘nvmf_trtype_str’
libnvme-1.16.1/src/nvme/fabrics.c:1061:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1069:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1092:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1098:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1098:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1099:13: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1099:13: call_function: calling ‘__nvmf_supported_options’ from ‘nvmf_connect_disc_entry’
#  722|   
#  723|   	r->options = calloc(1, sizeof(*r->options));
#  724|-> 	if (!r->options)
#  725|   		return -ENOMEM;
#  726|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def58]
libnvme-1.16.1/src/nvme/fabrics.c:760:22: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvmf_dev, 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1004:13: enter_function: entry to ‘nvmf_connect_disc_entry’
libnvme-1.16.1/src/nvme/fabrics.c:1054:21: call_function: calling ‘nvmf_trtype_str’ from ‘nvmf_connect_disc_entry’
libnvme-1.16.1/src/nvme/fabrics.c:1054:21: return_function: returning to ‘nvmf_connect_disc_entry’ from ‘nvmf_trtype_str’
libnvme-1.16.1/src/nvme/fabrics.c:1061:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1069:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1092:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1098:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1098:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1099:13: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1099:13: call_function: calling ‘__nvmf_supported_options’ from ‘nvmf_connect_disc_entry’
#  758|   
#  759|   	while ((p = strsep(&options, ",\n")) != NULL) {
#  760|-> 		if (!*p)
#  761|   			continue;
#  762|   		v = strsep(&p, "= ");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def59]
libnvme-1.16.1/src/nvme/fabrics.c:1345:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1332:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1332:12: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1334:16: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1338:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1341:21: acquire_resource: opened here
libnvme-1.16.1/src/nvme/fabrics.c:1342:20: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1344:23: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1345:17: danger: ‘open(&filename, 0)’ leaks here; was opened at [(5)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/4)
# 1343|   			continue;
# 1344|   		len = read(f, buf, 512);
# 1345|-> 		close(f);
# 1346|   		if (len <= 0)
# 1347|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def60]
libnvme-1.16.1/src/nvme/fabrics.c:1357:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1332:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1332:12: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1334:16: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1338:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1353:21: acquire_resource: opened here
libnvme-1.16.1/src/nvme/fabrics.c:1357:17: danger: ‘open(&filename, 0)’ leaks here; was opened at [(5)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/4)
# 1355|   			continue;
# 1356|   		len = read(f, buf, 512);
# 1357|-> 		close(f);
# 1358|   		if (len <= 0)
# 1359|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def61]
libnvme-1.16.1/src/nvme/fabrics.c:1485:29: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(f, 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1480:14: acquire_resource: opened here
libnvme-1.16.1/src/nvme/fabrics.c:1481:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1484:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1485:29: danger: ‘open(f, 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
# 1483|   
# 1484|   	memset(buf, 0, len);
# 1485|-> 	ret = read(fd, buf, len - 1);
# 1486|   
# 1487|   	if (ret < 0 || !strlen(buf))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
libnvme-1.16.1/src/nvme/fabrics.c:1695:9: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, (long unsigned int)tdl)’
libnvme-1.16.1/src/nvme/fabrics.c:1639:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1647:14: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1647:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1655:14: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1655:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1663:14: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1663:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1671:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1671:12: branch_false: following ‘false’ branch (when the strings are equal)...
libnvme-1.16.1/src/nvme/fabrics.c:1680:28: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1683:39: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/fabrics.c:1684:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1689:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1698:15: throw: if ‘get_entity_name’ throws an exception...
libnvme-1.16.1/src/nvme/fabrics.c:1695:9: danger: ‘calloc(1, (long unsigned int)tdl)’ leaks here; was allocated at [(11)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/10)
# 1693|   	dim->ektype = cpu_to_le16(0x5F); /* must be 0x5F per specs */
# 1694|   
# 1695|-> 	memcpy(dim->eid, c->s->h->hostnqn,
# 1696|   	       MIN(sizeof(dim->eid), strlen(c->s->h->hostnqn)));
# 1697|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def63]
libnvme-1.16.1/src/nvme/fabrics.c:1801:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*c.dctype’ where non-null expected
libnvme-1.16.1/src/nvme/fabrics.c:1795:6: enter_function: entry to ‘nvmf_is_registration_supported’
libnvme-1.16.1/src/nvme/fabrics.c:1798:21: call_function: calling ‘nvme_fetch_cntrltype_dctype_from_id’ from ‘nvmf_is_registration_supported’
libnvme-1.16.1/src/nvme/fabrics.c:1798:21: return_function: returning to ‘nvmf_is_registration_supported’ from ‘nvme_fetch_cntrltype_dctype_from_id’
libnvme-1.16.1/src/nvme/fabrics.c:1798:20: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1801:24: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1801:17: danger: argument 1 (‘*c.dctype’) from [(12)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/11) could be NULL where non-null expected
# 1799|   			return false;
# 1800|   
# 1801|-> 	return !strcmp(c->dctype, "ddc") || !strcmp(c->dctype, "cdc");
# 1802|   }
# 1803|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def64]
libnvme-1.16.1/src/nvme/fabrics.c:1833:22: warning[-Wanalyzer-malloc-leak]: leak of ‘unescape_uri(elem, 0)’
libnvme-1.16.1/src/nvme/fabrics.c:1847:26: enter_function: entry to ‘nvme_parse_uri’
libnvme-1.16.1/src/nvme/fabrics.c:1871:12: branch_false: following ‘false’ branch (when ‘uri’ is non-NULL)...
libnvme-1.16.1/src/nvme/fabrics.c:1874:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1874:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1881:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1881:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1889:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1897:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1910:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1910:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1914:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1915:20: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1920:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1921:20: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1927:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1934:20: branch_true: following ‘true’ branch (when ‘elem’ is non-NULL)...
libnvme-1.16.1/src/nvme/fabrics.c:1935:25: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1935:51: call_function: calling ‘unescape_uri’ from ‘nvme_parse_uri’
libnvme-1.16.1/src/nvme/fabrics.c:1935:51: return_function: returning to ‘nvme_parse_uri’ from ‘unescape_uri’
libnvme-1.16.1/src/nvme/fabrics.c:1833:22: danger: ‘unescape_uri(elem, 0)’ leaks here; was allocated at [(22)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/21)
# 1831|   
# 1832|   	l = len > 0 ? len : strlen(str);
# 1833|-> 	dst = malloc(l + 1);
# 1834|   	for (i = 0, j = 0; i < l; i++, j++) {
# 1835|   		if (str[i] == '%' && i + 2 < l &&

Error: GCC_ANALYZER_WARNING (CWE-476): [#def65]
libnvme-1.16.1/src/nvme/fabrics.c:1837:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.16.1/src/nvme/fabrics.c:1832:9: branch_false: following ‘false’ branch (when ‘len > 0’)...
libnvme-1.16.1/src/nvme/fabrics.c:1833:22: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1833:15: acquire_memory: this call could return NULL
libnvme-1.16.1/src/nvme/fabrics.c:1834:28: branch_true: following ‘true’ branch (when ‘l > i’)...
libnvme-1.16.1/src/nvme/fabrics.c:1835:24: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1835:20: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1837:34: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/fabrics.c:1837:25: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/2)
# 1835|   		if (str[i] == '%' && i + 2 < l &&
# 1836|   		    IS_XDIGIT(str[i + 1]) && IS_XDIGIT(str[i + 2])) {
# 1837|-> 			dst[j] = (XDIGIT_VAL(str[i + 1]) << 4) +
# 1838|   				  XDIGIT_VAL(str[i + 2]);
# 1839|   			i += 2;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def66]
libnvme-1.16.1/src/nvme/fabrics.c:1841:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.16.1/src/nvme/fabrics.c:1832:9: branch_false: following ‘false’ branch (when ‘len > 0’)...
libnvme-1.16.1/src/nvme/fabrics.c:1833:22: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1833:15: acquire_memory: this call could return NULL
libnvme-1.16.1/src/nvme/fabrics.c:1834:28: branch_true: following ‘true’ branch (when ‘l > i’)...
libnvme-1.16.1/src/nvme/fabrics.c:1835:24: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1841:25: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/2)
# 1839|   			i += 2;
# 1840|   		} else
# 1841|-> 			dst[j] = str[i];
# 1842|   	}
# 1843|   	dst[j] = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def67]
libnvme-1.16.1/src/nvme/fabrics.c:1843: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dst
# 1841|   			dst[j] = str[i];
# 1842|   	}
# 1843|-> 	dst[j] = '\0';
# 1844|   	return dst;
# 1845|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def68]
libnvme-1.16.1/src/nvme/fabrics.c:1843:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.16.1/src/nvme/fabrics.c:1832:9: branch_true: following ‘true’ branch (when ‘len <= 0’)...
libnvme-1.16.1/src/nvme/fabrics.c:1832:29: branch_true: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1833:15: acquire_memory: this call could return NULL
libnvme-1.16.1/src/nvme/fabrics.c:1834:28: branch_false: following ‘false’ branch (when ‘l <= i’)...
libnvme-1.16.1/src/nvme/fabrics.c:1843:12: branch_false: ...to here
libnvme-1.16.1/src/nvme/fabrics.c:1843:9: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/2)
# 1841|   			dst[j] = str[i];
# 1842|   	}
# 1843|-> 	dst[j] = '\0';
# 1844|   	return dst;
# 1845|   }

Error: CPPCHECK_WARNING (CWE-758): [#def69]
libnvme-1.16.1/src/nvme/ioctl.c:2090: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 2088|   		((args->prinfor & 0xf) << 12) | ((args->dtype & 0xf) << 20) |
# 2089|   		((args->prinfow & 0xf) << 26) | ((args->fua & 0x1) << 30) |
# 2090|-> 		((args->lr & 0x1) << 31);
# 2091|   
# 2092|   	if (args->args_size == size_v1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def70]
libnvme-1.16.1/src/nvme/ioctl.h:608:16: warning[-Wanalyzer-malloc-leak]: leak of ‘descs’
libnvme-1.16.1/test/test.c:274:12: enter_function: entry to ‘test_namespace’
libnvme-1.16.1/test/test.c:283:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/test/test.c:286:9: branch_false: ...to here
libnvme-1.16.1/test/test.c:296:17: acquire_memory: allocated here
libnvme-1.16.1/test/test.c:297:12: branch_false: following ‘false’ branch (when ‘descs’ is non-NULL)...
libnvme-1.16.1/test/test.c:300:15: call_function: inlined call to ‘nvme_identify_ns_descs’ from ‘test_namespace’
#  606|   	};
#  607|   
#  608|-> 	return nvme_identify(&args);
#  609|   }
#  610|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def71]
libnvme-1.16.1/src/nvme/ioctl.h:608:16: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnvme-1.16.1/test/ioctl/identify.c:81:13: enter_function: entry to ‘test_ns_descs’
libnvme-1.16.1/test/ioctl/identify.c:95:14: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/identify.c:96:9: branch_true: following ‘true’ branch (when ‘id’ is non-NULL)...
libnvme-1.16.1/test/ioctl/identify.c:97:9: branch_true: ...to here
libnvme-1.16.1/test/ioctl/identify.c:98:15: call_function: inlined call to ‘nvme_identify_ns_descs’ from ‘test_ns_descs’
#  606|   	};
#  607|   
#  608|-> 	return nvme_identify(&args);
#  609|   }
#  610|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def72]
libnvme-1.16.1/src/nvme/ioctl.h:988:16: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:21:13: enter_function: entry to ‘show_zns_properties’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:32:13: call_function: inlined call to ‘nvme_zns_identify_ns’ from ‘show_zns_properties’
#  986|   	};
#  987|   
#  988|-> 	return nvme_identify(&args);
#  989|   }
#  990|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def73]
libnvme-1.16.1/src/nvme/ioctl.h:1020:16: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:21:13: enter_function: entry to ‘show_zns_properties’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:41:13: call_function: inlined call to ‘nvme_zns_identify_ctrl’ from ‘show_zns_properties’
# 1018|   	};
# 1019|   
# 1020|-> 	return nvme_identify(&args);
# 1021|   }
# 1022|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def74]
libnvme-1.16.1/src/nvme/ioctl.h:4512:16: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:21:13: enter_function: entry to ‘show_zns_properties’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:41:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/test/zns.c:47:29: branch_false: ...to here
libnvme-1.16.1/test/zns.c:49:13: call_function: inlined call to ‘nvme_zns_report_zones’ from ‘show_zns_properties’
# 4510|   	};
# 4511|   
# 4512|-> 	return nvme_zns_mgmt_recv(&args);
# 4513|   }
# 4514|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def75]
libnvme-1.16.1/src/nvme/json.c:212:36: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(config_file, 0)’
libnvme-1.16.1/src/nvme/json.c:238:5: enter_function: entry to ‘json_read_config’
libnvme-1.16.1/src/nvme/json.c:243:14: acquire_resource: opened here
libnvme-1.16.1/src/nvme/json.c:244:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/json.c:249:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/json.c:249:21: call_function: calling ‘parse_json’ from ‘json_read_config’
libnvme-1.16.1/src/nvme/json.c:249:21: return_function: returning to ‘json_read_config’ from ‘parse_json’
libnvme-1.16.1/src/nvme/json.c:212:36: danger: ‘open(config_file, 0)’ leaks here; was opened at [(2)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/1)
#  210|   
#  211|   	while ((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) {
#  212|-> 		str = realloc(ptr, len + ret);
#  213|   		if (!str)
#  214|   			return NULL;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def76]
libnvme-1.16.1/src/nvme/linux.c:703:8: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ctx’
libnvme-1.16.1/src/nvme/linux.c:1413:7: enter_function: entry to ‘nvme_generate_tls_key_identity’
libnvme-1.16.1/src/nvme/linux.c:1423:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1428:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1429:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1434:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1435:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1440:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1441:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity’
#  701|   }
#  702|   
#  703|-> static DEFINE_CLEANUP_FUNC(
#  704|   	cleanup_evp_pkey_ctx, EVP_PKEY_CTX *, EVP_PKEY_CTX_free)
#  705|   #define _cleanup_evp_pkey_ctx_ __cleanup__(cleanup_evp_pkey_ctx)

Error: CPPCHECK_WARNING (CWE-401): [#def77]
libnvme-1.16.1/src/nvme/linux.c:762: error[memleak]: Memory leak: hkdf_info
#  760|   	if (hmac == NVME_HMAC_ALG_NONE) {
#  761|   		memcpy(retained, configured, key_len);
#  762|-> 		return key_len;
#  763|   	}
#  764|   

Error: CPPCHECK_WARNING (CWE-401): [#def78]
libnvme-1.16.1/src/nvme/linux.c:768: error[memleak]: Memory leak: hkdf_info
#  766|   	if (!md || !hmac_len) {
#  767|   		errno = EINVAL;
#  768|-> 		return -1;
#  769|   	}
#  770|   

Error: CPPCHECK_WARNING (CWE-401): [#def79]
libnvme-1.16.1/src/nvme/linux.c:774: error[memleak]: Memory leak: hkdf_info
#  772|   	if (!ctx) {
#  773|   		errno = ENOMEM;
#  774|-> 		return -1;
#  775|   	}
#  776|   

Error: CPPCHECK_WARNING (CWE-401): [#def80]
libnvme-1.16.1/src/nvme/linux.c:779: error[memleak]: Memory leak: hkdf_info
#  777|   	if (EVP_PKEY_derive_init(ctx) <= 0) {
#  778|   		errno = ENOMEM;
#  779|-> 		return -1;
#  780|   	}
#  781|   	if (EVP_PKEY_CTX_set_hkdf_md(ctx, md) <= 0) {

Error: CPPCHECK_WARNING (CWE-401): [#def81]
libnvme-1.16.1/src/nvme/linux.c:783: error[memleak]: Memory leak: hkdf_info
#  781|   	if (EVP_PKEY_CTX_set_hkdf_md(ctx, md) <= 0) {
#  782|   		errno = ENOKEY;
#  783|-> 		return -1;
#  784|   	}
#  785|   	if (EVP_PKEY_CTX_set1_hkdf_key(ctx, configured, key_len) <= 0) {

Error: CPPCHECK_WARNING (CWE-401): [#def82]
libnvme-1.16.1/src/nvme/linux.c:787: error[memleak]: Memory leak: hkdf_info
#  785|   	if (EVP_PKEY_CTX_set1_hkdf_key(ctx, configured, key_len) <= 0) {
#  786|   		errno = ENOKEY;
#  787|-> 		return -1;
#  788|   	}
#  789|   

Error: CPPCHECK_WARNING (CWE-401): [#def83]
libnvme-1.16.1/src/nvme/linux.c:792: error[memleak]: Memory leak: hkdf_info
#  790|   	if (key_len > USHRT_MAX) {
#  791|   		errno = EINVAL;
#  792|-> 		return -1;
#  793|   	}
#  794|   	pos = (char *)hkdf_info;

Error: CPPCHECK_WARNING (CWE-401): [#def84]
libnvme-1.16.1/src/nvme/linux.c:949: error[memleak]: Memory leak: hkdf_info
#  947|   	if (!md || !hmac_len) {
#  948|   		errno = EINVAL;
#  949|-> 		return -1;
#  950|   	}
#  951|   

Error: CPPCHECK_WARNING (CWE-401): [#def85]
libnvme-1.16.1/src/nvme/linux.c:955: error[memleak]: Memory leak: hkdf_info
#  953|   	if (!ctx) {
#  954|   		errno = ENOMEM;
#  955|-> 		return -1;
#  956|   	}
#  957|   

Error: CPPCHECK_WARNING (CWE-401): [#def86]
libnvme-1.16.1/src/nvme/linux.c:960: error[memleak]: Memory leak: hkdf_info
#  958|   	if (EVP_PKEY_derive_init(ctx) <= 0) {
#  959|   		errno = ENOMEM;
#  960|-> 		return -1;
#  961|   	}
#  962|   	if (EVP_PKEY_CTX_set_hkdf_md(ctx, md) <= 0) {

Error: CPPCHECK_WARNING (CWE-401): [#def87]
libnvme-1.16.1/src/nvme/linux.c:964: error[memleak]: Memory leak: hkdf_info
#  962|   	if (EVP_PKEY_CTX_set_hkdf_md(ctx, md) <= 0) {
#  963|   		errno = ENOKEY;
#  964|-> 		return -1;
#  965|   	}
#  966|   	if (EVP_PKEY_CTX_set1_hkdf_key(ctx, retained, key_len) <= 0) {

Error: CPPCHECK_WARNING (CWE-401): [#def88]
libnvme-1.16.1/src/nvme/linux.c:968: error[memleak]: Memory leak: hkdf_info
#  966|   	if (EVP_PKEY_CTX_set1_hkdf_key(ctx, retained, key_len) <= 0) {
#  967|   		errno = ENOKEY;
#  968|-> 		return -1;
#  969|   	}
#  970|   

Error: CPPCHECK_WARNING (CWE-401): [#def89]
libnvme-1.16.1/src/nvme/linux.c:973: error[memleak]: Memory leak: hkdf_info
#  971|   	if (key_len > USHRT_MAX) {
#  972|   		errno = EINVAL;
#  973|-> 		return -1;
#  974|   	}
#  975|   	pos = (char *)hkdf_info;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def90]
libnvme-1.16.1/src/nvme/linux.c:1116:8: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘lib_ctx’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1114|   }
# 1115|   
# 1116|-> static DEFINE_CLEANUP_FUNC(
# 1117|   	cleanup_ossl_lib_ctx, OSSL_LIB_CTX *, OSSL_LIB_CTX_free)
# 1118|   #define _cleanup_ossl_lib_ctx_ __cleanup__(cleanup_ossl_lib_ctx)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def91]
libnvme-1.16.1/src/nvme/linux.c:1262:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1260|   	}
# 1261|   
# 1262|-> 	if (!EVP_MAC_init(mac_ctx, retained, key_len, params)) {
# 1263|   		errno = ENOKEY;
# 1264|   		return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def92]
libnvme-1.16.1/src/nvme/linux.c:1266:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1264|   		return -1;
# 1265|   	}
# 1266|-> 	if (!EVP_MAC_update(mac_ctx, (unsigned char *)hostnqn,
# 1267|   			    strlen(hostnqn))) {
# 1268|   		errno = ENOKEY;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def93]
libnvme-1.16.1/src/nvme/linux.c:1271:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1269|   		return -1;
# 1270|   	}
# 1271|-> 	if (!EVP_MAC_update(mac_ctx, (unsigned char *)" ", 1)) {
# 1272|   		errno = ENOKEY;
# 1273|   		return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def94]
libnvme-1.16.1/src/nvme/linux.c:1275:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1273|   		return -1;
# 1274|   	}
# 1275|-> 	if (!EVP_MAC_update(mac_ctx, (unsigned char *)subsysnqn,
# 1276|   			    strlen(subsysnqn))) {
# 1277|   		errno = ENOKEY;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def95]
libnvme-1.16.1/src/nvme/linux.c:1280:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1278|   		return -1;
# 1279|   	}
# 1280|-> 	if (!EVP_MAC_update(mac_ctx, (unsigned char *)" ", 1)) {
# 1281|   		errno = ENOKEY;
# 1282|   		return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def96]
libnvme-1.16.1/src/nvme/linux.c:1284:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1282|   		return -1;
# 1283|   	}
# 1284|-> 	if (!EVP_MAC_update(mac_ctx, (unsigned char *)hmac_seed,
# 1285|   			    strlen(hmac_seed))) {
# 1286|   		errno = ENOKEY;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def97]
libnvme-1.16.1/src/nvme/linux.c:1289:14: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(key_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1287|   		return -1;
# 1288|   	}
# 1289|-> 	if (!EVP_MAC_final(mac_ctx, psk_ctx, &hmac_len, key_len)) {
# 1290|   		errno = ENOKEY;
# 1291|   		return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def98]
libnvme-1.16.1/src/nvme/linux.c:1373:23: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(digest_len)’
libnvme-1.16.1/src/nvme/linux.c:1451:7: enter_function: entry to ‘nvme_generate_tls_key_identity_compat’
libnvme-1.16.1/src/nvme/linux.c:1461:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1466:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1467:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:1472:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1473:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1478:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1479:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity_compat’
# 1371|   			return -1;
# 1372|   		}
# 1373|-> 		ret = derive_psk_digest(hostnqn, subsysnqn, version, cipher,
# 1374|   					retained, key_len,
# 1375|   					digest, digest_len);

Error: CPPCHECK_WARNING (CWE-401): [#def99]
libnvme-1.16.1/src/nvme/linux.c:1674: error[memleak]: Memory leak: identity
# 1672|   	if (!psk) {
# 1673|   		errno = ENOMEM;
# 1674|-> 		return 0;
# 1675|   	}
# 1676|   	memset(psk, 0, key_len);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def100]
libnvme-1.16.1/src/nvme/linux.c:2006:16: warning[-Wanalyzer-malloc-leak]: leak of ‘encoded_key’
libnvme-1.16.1/src/nvme/linux.c:1979:20: branch_false: following ‘false’ branch (when ‘key_len == 32’)...
libnvme-1.16.1/src/nvme/linux.c:1989:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1999:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/linux.c:2000:12: branch_false: following ‘false’ branch (when ‘encoded_key’ is non-NULL)...
libnvme-1.16.1/src/nvme/linux.c:2004:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:2006:16: throw: if ‘base64_encode’ throws an exception...
libnvme-1.16.1/src/nvme/linux.c:2006:16: danger: ‘encoded_key’ leaks here; was allocated at [(3)](sarif:/runs/0/results/44/codeFlows/0/threadFlows/0/locations/2)
# 2004|   	memset(encoded_key, 0, encoded_len);
# 2005|   	len = sprintf(encoded_key, "NVMeTLSkey-%x:%02x:", version, hmac);
# 2006|-> 	len += base64_encode(raw_secret, raw_len, encoded_key + len);
# 2007|   	encoded_key[len++] = ':';
# 2008|   	encoded_key[len++] = '\0';

Error: GCC_ANALYZER_WARNING (CWE-401): [#def101]
libnvme-1.16.1/src/nvme/linux.c:2047:13: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_import_tls_key_versioned(key, & version, & hmac, & key_len)’
libnvme-1.16.1/src/nvme/linux.c:1754:13: enter_function: entry to ‘__nvme_import_tls_key’
libnvme-1.16.1/src/nvme/linux.c:1763:20: call_function: calling ‘nvme_import_tls_key_versioned’ from ‘__nvme_import_tls_key’
libnvme-1.16.1/src/nvme/linux.c:1763:20: return_function: returning to ‘__nvme_import_tls_key’ from ‘nvme_import_tls_key_versioned’
libnvme-1.16.1/src/nvme/linux.c:1765:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1768:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/linux.c:1768:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/linux.c:1781:16: call_function: calling ‘nvme_update_key’ from ‘__nvme_import_tls_key’
libnvme-1.16.1/src/nvme/linux.c:2047:13: danger: ‘nvme_import_tls_key_versioned(key, & version, & hmac, & key_len)’ leaks here; was allocated at [(16)](sarif:/runs/0/results/45/codeFlows/0/threadFlows/0/locations/15)
# 2045|   	}
# 2046|   
# 2047|-> 	if (_version != 1) {
# 2048|   		errno = EINVAL;
# 2049|   		return NULL;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def102]
libnvme-1.16.1/src/nvme/mi-mctp.c:113:14: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘sd’
libnvme-1.16.1/src/nvme/mi-mctp.c:104:14: acquire_resource: socket created here
libnvme-1.16.1/src/nvme/mi-mctp.c:105:12: branch_false: following ‘false’ branch (when ‘sd >= 0’)...
libnvme-1.16.1/src/nvme/mi-mctp.c:108:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:113:14: throw: if ‘connect’ throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:113:14: danger: ‘sd’ leaks here
#  111|   	remote_addr.smctp_type = MCTP_TYPE_NVME;
#  112|   	/* connect() will specify a remote EID for the upcoming bind() */
#  113|-> 	rc = connect(sd, (struct sockaddr *)&remote_addr, sizeof(remote_addr));
#  114|   	if (rc)
#  115|   		goto err_close;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def103]
libnvme-1.16.1/src/nvme/mi-mctp.c:502:14: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.16.1/src/nvme/mi-mctp.c:420:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:426:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:426:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:431:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:464:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:473:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:474:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:475:29: branch_true: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:476:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi-mctp.c:484:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:502:14: throw: if the called function throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:502:14: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/8)
#  500|   	timeout = ep->timeout ?: -1;
#  501|   retry:
#  502|-> 	rc = ops.poll(pollfds, 1, timeout);
#  503|   	if (rc < 0) {
#  504|   		if (errno == EINTR)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def104]
libnvme-1.16.1/src/nvme/mi-mctp.c:507:17: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.16.1/src/nvme/mi-mctp.c:420:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:426:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:426:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:431:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:464:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:473:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:474:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:475:29: branch_true: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:476:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi-mctp.c:484:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:503:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:504:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:507:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:507:17: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8)
#  505|   			goto retry;
#  506|   		errno_save = errno;
#  507|-> 		nvme_msg(ep->root, LOG_ERR,
#  508|   			 "Failed polling on MCTP socket: %m");
#  509|   		errno = errno_save;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def105]
libnvme-1.16.1/src/nvme/mi-mctp.c:514:17: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.16.1/src/nvme/mi-mctp.c:420:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:426:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:426:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:431:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:464:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:473:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:474:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:475:29: branch_true: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:476:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi-mctp.c:484:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:513:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:514:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:514:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:514:17: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/8)
#  512|   
#  513|   	if (rc == 0) {
#  514|-> 		nvme_msg(ep->root, LOG_DEBUG, "Timeout on MCTP socket");
#  515|   		errno = ETIMEDOUT;
#  516|   		rc = -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def106]
libnvme-1.16.1/src/nvme/mi-mctp.c:521:15: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.16.1/src/nvme/mi-mctp.c:420:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:426:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:426:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:431:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:464:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:473:20: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:474:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:475:29: branch_true: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:476:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi-mctp.c:484:17: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:513:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:521:15: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:521:15: throw: if the called function throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:521:15: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/8)
#  519|   
#  520|   	rc = -1;
#  521|-> 	len = ops.recvmsg(mctp->sd, &resp_msg, MSG_DONTWAIT);
#  522|   
#  523|   	if (len < 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def107]
libnvme-1.16.1/src/nvme/mi-mctp.c:712:20: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.16.1/src/nvme/mi-mctp.c:682:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:685:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:686:12: branch_false: following ‘false’ branch (when ‘mctp’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi-mctp.c:691:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:696:26: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/mi-mctp.c:697:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:702:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:704:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:709:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:712:20: throw: if the called function throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:712:20: danger: ‘<unknown>’ leaks here; was allocated at [(5)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/4)
#  710|   	mctp->eid = eid;
#  711|   
#  712|-> 	mctp->sd = ops.msg_socket();
#  713|   	if (mctp->sd < 0) {
#  714|   		errno_save = errno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def108]
libnvme-1.16.1/src/nvme/mi-mctp.c:712:20: warning[-Wanalyzer-malloc-leak]: leak of ‘mctp’
libnvme-1.16.1/src/nvme/mi-mctp.c:682:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:685:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:685:16: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/mi-mctp.c:686:12: branch_false: following ‘false’ branch (when ‘mctp’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi-mctp.c:691:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:697:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:702:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:704:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi-mctp.c:709:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi-mctp.c:712:20: throw: if the called function throws an exception...
libnvme-1.16.1/src/nvme/mi-mctp.c:712:20: danger: ‘mctp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  710|   	mctp->eid = eid;
#  711|   
#  712|-> 	mctp->sd = ops.msg_socket();
#  713|   	if (mctp->sd < 0) {
#  714|   		errno_save = errno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def109]
libnvme-1.16.1/src/nvme/mi.c:288:9: warning[-Wanalyzer-malloc-leak]: leak of ‘enabled_list’
libnvme-1.16.1/src/nvme/mi.c:2472:5: enter_function: entry to ‘nvme_mi_aem_enable’
libnvme-1.16.1/src/nvme/mi.c:2476:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2481:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2485:40: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2493:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2495:14: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2495:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2498:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2503:14: call_function: calling ‘aem_disable_enabled’ from ‘nvme_mi_aem_enable’
#  286|   	timespec_sub(&next, &now, &delay);
#  287|   
#  288|-> 	nanosleep(&delay, NULL);
#  289|   }
#  290|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def110]
libnvme-1.16.1/src/nvme/mi.c:288:9: warning[-Wanalyzer-malloc-leak]: leak of ‘request’
libnvme-1.16.1/src/nvme/mi.c:2380:12: enter_function: entry to ‘aem_sync’
libnvme-1.16.1/src/nvme/mi.c:2396:58: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/mi.c:2398:12: branch_false: following ‘false’ branch (when ‘request’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi.c:2401:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2416:18: call_function: calling ‘nvme_mi_mi_config_set_async_event’ from ‘aem_sync’
#  286|   	timespec_sub(&next, &now, &delay);
#  287|   
#  288|-> 	nanosleep(&delay, NULL);
#  289|   }
#  290|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def111]
libnvme-1.16.1/src/nvme/mi.c:544:14: warning[-Wanalyzer-malloc-leak]: leak of ‘enabled_list’
libnvme-1.16.1/src/nvme/mi.c:2472:5: enter_function: entry to ‘nvme_mi_aem_enable’
libnvme-1.16.1/src/nvme/mi.c:2476:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2481:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2485:40: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2493:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2495:14: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2495:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2498:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2503:14: call_function: calling ‘aem_disable_enabled’ from ‘nvme_mi_aem_enable’
#  542|   		nvme_mi_insert_delay(ep);
#  543|   
#  544|-> 	rc = ep->transport->submit(ep, req, resp);
#  545|   
#  546|   	if (nvme_mi_ep_has_quirk(ep, NVME_QUIRK_MIN_INTER_COMMAND_TIME))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def112]
libnvme-1.16.1/src/nvme/mi.c:544:14: warning[-Wanalyzer-malloc-leak]: leak of ‘request’
libnvme-1.16.1/src/nvme/mi.c:2380:12: enter_function: entry to ‘aem_sync’
libnvme-1.16.1/src/nvme/mi.c:2396:58: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/mi.c:2398:12: branch_false: following ‘false’ branch (when ‘request’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi.c:2401:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2416:18: call_function: calling ‘nvme_mi_mi_config_set_async_event’ from ‘aem_sync’
#  542|   		nvme_mi_insert_delay(ep);
#  543|   
#  544|-> 	rc = ep->transport->submit(ep, req, resp);
#  545|   
#  546|   	if (nvme_mi_ep_has_quirk(ep, NVME_QUIRK_MIN_INTER_COMMAND_TIME))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def113]
libnvme-1.16.1/src/nvme/mi.c:550:17: warning[-Wanalyzer-malloc-leak]: leak of ‘enabled_list’
libnvme-1.16.1/src/nvme/mi.c:2546:5: enter_function: entry to ‘nvme_mi_aem_get_enabled’
libnvme-1.16.1/src/nvme/mi.c:2549:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/mi.c:2555:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2556:59: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/mi.c:2558:12: branch_false: following ‘false’ branch (when ‘enabled_list’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi.c:2561:14: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2561:14: call_function: calling ‘nvme_mi_mi_config_get_async_event’ from ‘nvme_mi_aem_get_enabled’
#  548|   
#  549|   	if (rc) {
#  550|-> 		nvme_msg(ep->root, LOG_INFO, "transport failure\n");
#  551|   		return rc;
#  552|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def114]
libnvme-1.16.1/src/nvme/mi.c:550:17: warning[-Wanalyzer-malloc-leak]: leak of ‘request’
libnvme-1.16.1/src/nvme/mi.c:2380:12: enter_function: entry to ‘aem_sync’
libnvme-1.16.1/src/nvme/mi.c:2396:58: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/mi.c:2398:12: branch_false: following ‘false’ branch (when ‘request’ is non-NULL)...
libnvme-1.16.1/src/nvme/mi.c:2401:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/mi.c:2416:18: call_function: calling ‘nvme_mi_mi_config_set_async_event’ from ‘aem_sync’
#  548|   
#  549|   	if (rc) {
#  550|-> 		nvme_msg(ep->root, LOG_INFO, "transport failure\n");
#  551|   		return rc;
#  552|   	}

Error: CPPCHECK_WARNING (CWE-758): [#def115]
libnvme-1.16.1/src/nvme/mi.c:1927: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1925|   	nvme_mi_mi_init_req(ep, &req, &req_hdr, 0,
# 1926|   		nvme_mi_mi_opcode_subsys_health_status_poll);
# 1927|-> 	req_hdr.cdw1 = (clear ? 1 : 0) << 31;
# 1928|   
# 1929|   	memset(&resp, 0, sizeof(resp));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def116]
libnvme-1.16.1/src/nvme/nbft.c:93:17: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#   91|   
#   92|   	if (!in_heap(header, obj)) {
#   93|-> 		nvme_msg(NULL, LOG_DEBUG,
#   94|   			 "file %s: field '%s' in descriptor '%s' has invalid offset or length\n",
#   95|   			 filename, fieldname, descriptorname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def117]
libnvme-1.16.1/src/nvme/nbft.c:93:17: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#   91|   
#   92|   	if (!in_heap(header, obj)) {
#   93|-> 		nvme_msg(NULL, LOG_DEBUG,
#   94|   			 "file %s: field '%s' in descriptor '%s' has invalid offset or length\n",
#   95|   			 filename, fieldname, descriptorname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def118]
libnvme-1.16.1/src/nvme/nbft.c:93:17: warning[-Wanalyzer-malloc-leak]: leak of ‘ssns’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#   91|   
#   92|   	if (!in_heap(header, obj)) {
#   93|-> 		nvme_msg(NULL, LOG_DEBUG,
#   94|   			 "file %s: field '%s' in descriptor '%s' has invalid offset or length\n",
#   95|   			 filename, fieldname, descriptorname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def119]
libnvme-1.16.1/src/nvme/nbft.c:104:25: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  102|   	if (is_string) {
#  103|   		if (strnlen(*output, le16_to_cpu(obj.length) + 1) < le16_to_cpu(obj.length))
#  104|-> 			nvme_msg(NULL, LOG_DEBUG,
#  105|   				"file %s: string '%s' in descriptor '%s' is shorter (%zd) than specified length (%d)\n",
#  106|   				filename, fieldname, descriptorname,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def120]
libnvme-1.16.1/src/nvme/nbft.c:111:25: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  109|   		else if (strnlen(*output, le16_to_cpu(obj.length) + 1) >
#  110|   			le16_to_cpu(obj.length)) {
#  111|-> 			nvme_msg(NULL, LOG_DEBUG,
#  112|   				 "file %s: string '%s' in descriptor '%s' is not zero terminated\n",
#  113|   				 filename, fieldname, descriptorname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def121]
libnvme-1.16.1/src/nvme/nbft.c:224:25: warning[-Wanalyzer-malloc-leak]: leak of ‘ssns’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  222|   						       raw_ssns->primary_discovery_ctrl_index);
#  223|   		if (!ssns->discovery)
#  224|-> 			nvme_msg(NULL, LOG_DEBUG,
#  225|   				 "file %s: namespace %d discovery controller not found\n",
#  226|   				 nbft->filename, ssns->index);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def122]
libnvme-1.16.1/src/nvme/nbft.c:346:9: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  344|   		return -EINVAL;
#  345|   
#  346|-> 	verify(raw_hfi_info_tcp->structure_id == NBFT_DESC_HFI_TRINFO,
#  347|   	       "invalid ID in HFI transport descriptor");
#  348|   	verify(raw_hfi_info_tcp->version == 1,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def123]
libnvme-1.16.1/src/nvme/nbft.c:348:9: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  346|   	verify(raw_hfi_info_tcp->structure_id == NBFT_DESC_HFI_TRINFO,
#  347|   	       "invalid ID in HFI transport descriptor");
#  348|-> 	verify(raw_hfi_info_tcp->version == 1,
#  349|   	       "invalid version in HFI transport descriptor");
#  350|   	if (le16_to_cpu(raw_hfi_info_tcp->hfi_index) != hfi->index)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def124]
libnvme-1.16.1/src/nvme/nbft.c:351:17: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  349|   	       "invalid version in HFI transport descriptor");
#  350|   	if (le16_to_cpu(raw_hfi_info_tcp->hfi_index) != hfi->index)
#  351|-> 		nvme_msg(NULL, LOG_DEBUG,
#  352|   			 "file %s: HFI descriptor index %d does not match index in HFI transport descriptor\n",
#  353|   			 nbft->filename, hfi->index);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def125]
libnvme-1.16.1/src/nvme/nbft.c:423:17: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  421|   			goto fail;
#  422|   	} else {
#  423|-> 		nvme_msg(NULL, LOG_DEBUG,
#  424|   			 "file %s: invalid transport type %d\n",
#  425|   			 nbft->filename, raw_hfi->trtype);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def126]
libnvme-1.16.1/src/nvme/nbft.c:468:17: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  466|   	discovery->hfi = hfi_from_index(nbft, raw_discovery->hfi_index);
#  467|   	if (raw_discovery->hfi_index && !discovery->hfi)
#  468|-> 		nvme_msg(NULL, LOG_DEBUG,
#  469|   			 "file %s: discovery %d HFI not found\n",
#  470|   			 nbft->filename, discovery->index);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def127]
libnvme-1.16.1/src/nvme/nbft.c:474:17: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  472|   	discovery->security = security_from_index(nbft, raw_discovery->sec_index);
#  473|   	if (raw_discovery->sec_index && !discovery->security)
#  474|-> 		nvme_msg(NULL, LOG_DEBUG,
#  475|   			 "file %s: discovery %d security descriptor not found\n",
#  476|   			 nbft->filename, discovery->index);

Error: GCC_ANALYZER_WARNING (CWE-131): [#def128]
libnvme-1.16.1/src/nvme/nbft.c:511:9: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
libnvme-1.16.1/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:753:13: call_function: calling ‘parse_raw_nbft’ from ‘nvme_nbft_read’
#  509|   	int i, cnt;
#  510|   
#  511|-> 	nbft->security_list = calloc(num_sec + 1, sizeof(struct nbft_info_security));
#  512|   	for (i = 0, cnt = 0; i < num_sec; i++) {
#  513|   		if (read_security(nbft, &raw_sec_array[i], &nbft->security_list[cnt]) == 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def129]
libnvme-1.16.1/src/nvme/nbft.c:707:13: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:707:13: throw: if ‘fseek’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:707:13: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0)
#  705|   	}
#  706|   
#  707|-> 	i = fseek(raw_nbft_fp, 0L, SEEK_END);
#  708|   	if (i) {
#  709|   		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def130]
libnvme-1.16.1/src/nvme/nbft.c:707:13: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:707:13: throw: if ‘fseek’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:707:13: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
#  705|   	}
#  706|   
#  707|-> 	i = fseek(raw_nbft_fp, 0L, SEEK_END);
#  708|   	if (i) {
#  709|   		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",

Error: GCC_ANALYZER_WARNING (CWE-775): [#def131]
libnvme-1.16.1/src/nvme/nbft.c:709:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/nbft.c:709:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:709:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:709:17: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/0)
#  707|   	i = fseek(raw_nbft_fp, 0L, SEEK_END);
#  708|   	if (i) {
#  709|-> 		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",
#  710|   			 filename, strerror(errno));
#  711|   		fclose(raw_nbft_fp);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def132]
libnvme-1.16.1/src/nvme/nbft.c:709:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/nbft.c:709:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:709:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:709:17: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/0)
#  707|   	i = fseek(raw_nbft_fp, 0L, SEEK_END);
#  708|   	if (i) {
#  709|-> 		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",
#  710|   			 filename, strerror(errno));
#  711|   		fclose(raw_nbft_fp);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def133]
libnvme-1.16.1/src/nvme/nbft.c:716:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:716:25: throw: if ‘ftell’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:716:25: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/0)
#  714|   	}
#  715|   
#  716|-> 	raw_nbft_size = ftell(raw_nbft_fp);
#  717|   	rewind(raw_nbft_fp);
#  718|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def134]
libnvme-1.16.1/src/nvme/nbft.c:716:25: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:716:25: throw: if ‘ftell’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:716:25: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0)
#  714|   	}
#  715|   
#  716|-> 	raw_nbft_size = ftell(raw_nbft_fp);
#  717|   	rewind(raw_nbft_fp);
#  718|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def135]
libnvme-1.16.1/src/nvme/nbft.c:717:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:717:9: throw: if ‘rewind’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:717:9: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
#  715|   
#  716|   	raw_nbft_size = ftell(raw_nbft_fp);
#  717|-> 	rewind(raw_nbft_fp);
#  718|   
#  719|   	raw_nbft = malloc(raw_nbft_size);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def136]
libnvme-1.16.1/src/nvme/nbft.c:717:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:717:9: throw: if ‘rewind’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:717:9: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/0)
#  715|   
#  716|   	raw_nbft_size = ftell(raw_nbft_fp);
#  717|-> 	rewind(raw_nbft_fp);
#  718|   
#  719|   	raw_nbft = malloc(raw_nbft_size);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def137]
libnvme-1.16.1/src/nvme/nbft.c:721:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_true: following ‘true’ branch (when ‘raw_nbft’ is NULL)...
libnvme-1.16.1/src/nvme/nbft.c:721:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:721:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:721:17: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/0)
#  719|   	raw_nbft = malloc(raw_nbft_size);
#  720|   	if (!raw_nbft) {
#  721|-> 		nvme_msg(NULL, LOG_ERR, "Failed to allocate memory for NBFT table");
#  722|   		fclose(raw_nbft_fp);
#  723|   		errno = ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def138]
libnvme-1.16.1/src/nvme/nbft.c:721:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_true: following ‘true’ branch (when ‘raw_nbft’ is NULL)...
libnvme-1.16.1/src/nvme/nbft.c:721:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:721:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:721:17: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
#  719|   	raw_nbft = malloc(raw_nbft_size);
#  720|   	if (!raw_nbft) {
#  721|-> 		nvme_msg(NULL, LOG_ERR, "Failed to allocate memory for NBFT table");
#  722|   		fclose(raw_nbft_fp);
#  723|   		errno = ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def139]
libnvme-1.16.1/src/nvme/nbft.c:728:13: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/nbft.c:729:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:729:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:728:13: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
#  726|   
#  727|   	i = fread(raw_nbft, sizeof(*raw_nbft), raw_nbft_size, raw_nbft_fp);
#  728|-> 	if (i != raw_nbft_size) {
#  729|   		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",
#  730|   			 filename, strerror(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def140]
libnvme-1.16.1/src/nvme/nbft.c:728:13: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.16.1/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/nbft.c:729:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:729:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:728:13: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/0)
#  726|   
#  727|   	i = fread(raw_nbft, sizeof(*raw_nbft), raw_nbft_size, raw_nbft_fp);
#  728|-> 	if (i != raw_nbft_size) {
#  729|   		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",
#  730|   			 filename, strerror(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def141]
libnvme-1.16.1/src/nvme/nbft.c:729:17: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_nbft’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:719:20: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/nbft.c:729:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:729:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:729:17: danger: ‘raw_nbft’ leaks here; was allocated at [(5)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/4)
#  727|   	i = fread(raw_nbft, sizeof(*raw_nbft), raw_nbft_size, raw_nbft_fp);
#  728|   	if (i != raw_nbft_size) {
#  729|-> 		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",
#  730|   			 filename, strerror(errno));
#  731|   		fclose(raw_nbft_fp);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def142]
libnvme-1.16.1/src/nvme/nbft.c:743:17: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_nbft’
libnvme-1.16.1/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:719:20: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.16.1/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/nbft.c:742:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/nbft.c:743:17: branch_true: ...to here
libnvme-1.16.1/src/nvme/nbft.c:743:17: throw: if ‘__nvme_msg’ throws an exception...
libnvme-1.16.1/src/nvme/nbft.c:743:17: danger: ‘raw_nbft’ leaks here; was allocated at [(5)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/4)
#  741|   	*nbft = calloc(1, sizeof(struct nbft_info));
#  742|   	if (!*nbft) {
#  743|-> 		nvme_msg(NULL, LOG_ERR, "Could not allocate memory for NBFT\n");
#  744|   		free(raw_nbft);
#  745|   		errno = ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def143]
libnvme-1.16.1/src/nvme/tree.c:126:16: warning[-Wanalyzer-malloc-leak]: leak of ‘nvme_hostid_from_hostnqn(hnqn)’
libnvme-1.16.1/src/nvme/tree.c:2243:13: enter_function: entry to ‘nvme_scan_ctrl’
libnvme-1.16.1/src/nvme/tree.c:2256:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2261:19: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2264:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2274:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2274:21: call_function: calling ‘nvme_default_host’ from ‘nvme_scan_ctrl’
#  124|   		return NULL;
#  125|   
#  126|-> 	return strdup(uuid + strlen("uuid:"));
#  127|   }
#  128|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def144]
libnvme-1.16.1/src/nvme/tree.c:468:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘h’
libnvme-1.16.1/src/nvme/tree.c:2243:13: enter_function: entry to ‘nvme_scan_ctrl’
libnvme-1.16.1/src/nvme/tree.c:2256:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:2261:19: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2264:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2274:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2274:21: call_function: calling ‘nvme_default_host’ from ‘nvme_scan_ctrl’
#  466|   void nvme_host_set_hostsymname(nvme_host_t h, const char *hostsymname)
#  467|   {
#  468|-> 	free(h->hostsymname);
#  469|   	h->hostsymname = NULL;
#  470|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def145]
libnvme-1.16.1/src/nvme/tree.c:1438:9: warning[-Wanalyzer-malloc-leak]: leak of ‘c’
libnvme-1.16.1/src/nvme/tree.c:2144:20: enter_function: entry to ‘nvme_ctrl_alloc’
libnvme-1.16.1/src/nvme/tree.c:2155:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2160:16: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2161:12: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/tree.c:2166:22: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:2214:21: call_function: calling ‘nvme_lookup_ctrl’ from ‘nvme_ctrl_alloc’
# 1436|   	}
# 1437|   	c->fd = -1;
# 1438|-> 	nvmf_default_config(&c->cfg);
# 1439|   	list_head_init(&c->namespaces);
# 1440|   	list_head_init(&c->paths);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def146]
libnvme-1.16.1/src/nvme/tree.c:1899:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘r’
libnvme-1.16.1/src/nvme/tree.c:2310:6: enter_function: entry to ‘nvme_rescan_ctrl’
libnvme-1.16.1/src/nvme/tree.c:2312:25: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2313:12: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2313:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2315:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2315:9: call_function: calling ‘nvme_ctrl_scan_namespaces’ from ‘nvme_rescan_ctrl’
# 1897|   	int i;
# 1898|   
# 1899|-> 	if (r->create_only) {
# 1900|   		nvme_msg(r, LOG_DEBUG, "skipping namespace scan for ctrl %s\n",
# 1901|   			 c->name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def147]
libnvme-1.16.1/src/nvme/tree.c:1958:25: warning[-Wanalyzer-malloc-leak]: leak of ‘strndup(address, 10)’
libnvme-1.16.1/src/nvme/tree.c:1947:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:1950:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1951:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:1957:23: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1957:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:1958:25: throw: if ‘readdir’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:1958:25: danger: ‘strndup(address, 10)’ leaks here; was allocated at [(5)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/4)
# 1956|   
# 1957|   	target_addr = strndup(address, 10);
# 1958|-> 	while ((entry = readdir(slots_dir))) {
# 1959|   		if (entry->d_type == DT_DIR &&
# 1960|   		    strncmp(entry->d_name, ".", 1) != 0 &&

Error: GCC_ANALYZER_WARNING (CWE-401): [#def148]
libnvme-1.16.1/src/nvme/tree.c:1959:21: warning[-Wanalyzer-malloc-leak]: leak of ‘strndup(address, 10)’
libnvme-1.16.1/src/nvme/tree.c:1947:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:1950:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1951:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:1957:23: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1957:23: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:1958:16: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/tree.c:1959:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:1967:28: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:1971:32: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1971:32: throw: if ‘nvme_get_attr’ throws an exception...
libnvme-1.16.1/src/nvme/tree.c:1959:21: danger: ‘strndup(address, 10)’ leaks here; was allocated at [(5)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/4)
# 1957|   	target_addr = strndup(address, 10);
# 1958|   	while ((entry = readdir(slots_dir))) {
# 1959|-> 		if (entry->d_type == DT_DIR &&
# 1960|   		    strncmp(entry->d_name, ".", 1) != 0 &&
# 1961|   		    strncmp(entry->d_name, "..", 2) != 0) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def149]
libnvme-1.16.1/src/nvme/tree.c:1976:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘strndup(address, 10)’ where non-null expected
libnvme-1.16.1/src/nvme/tree.c:1947:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.16.1/src/nvme/tree.c:1950:21: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1951:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:1957:23: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1957:23: acquire_memory: this call could return NULL
libnvme-1.16.1/src/nvme/tree.c:1958:16: branch_true: following ‘true’ branch...
libnvme-1.16.1/src/nvme/tree.c:1959:21: branch_true: ...to here
libnvme-1.16.1/src/nvme/tree.c:1967:28: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.16.1/src/nvme/tree.c:1971:32: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:1976:29: danger: argument 2 (‘strndup(address, 10)’) from [(5)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 1974|   			if (!addr)
# 1975|   				continue;
# 1976|-> 			if (strcmp(addr, target_addr) == 0)
# 1977|   				return strdup(entry->d_name);
# 1978|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def150]
libnvme-1.16.1/src/nvme/tree.c:2075:9: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(path)’
libnvme-1.16.1/src/nvme/tree.c:2068:13: acquire_memory: allocated here
libnvme-1.16.1/src/nvme/tree.c:2069:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/src/nvme/tree.c:2075:9: branch_false: ...to here
libnvme-1.16.1/src/nvme/tree.c:2075:9: danger: ‘opendir(path)’ leaks here; was allocated at [(1)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/0)
# 2073|   		return -1;
# 2074|   	}
# 2075|-> 	closedir(d);
# 2076|   
# 2077|   	c->name = xstrdup(name);

Error: CPPCHECK_WARNING (CWE-758): [#def151]
libnvme-1.16.1/src/nvme/types.h:1737: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1735|   	NVME_CTRL_OAES_ANSAN		= NVME_VAL(CTRL_OAES_ANSAN),
# 1736|   	NVME_CTRL_OAES_ZD		= NVME_VAL(CTRL_OAES_ZD),
# 1737|-> 	NVME_CTRL_OAES_DL		= NVME_VAL(CTRL_OAES_DL),
# 1738|   };
# 1739|   

Error: CPPCHECK_WARNING (CWE-758): [#def152]
libnvme-1.16.1/src/nvme/types.h:9460: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 9458|   	NVME_FEATURE_AENCFG_NOTICE_LBA_STATUS			= 1 << 13,
# 9459|   	NVME_FEATURE_AENCFG_NOTICE_EG_EVENT			= 1 << 14,
# 9460|-> 	NVME_FEATURE_AENCFG_NOTICE_DISCOVERY_CHANGE		= 1 << 31,
# 9461|   };
# 9462|   

Error: CPPCHECK_WARNING (CWE-758): [#def153]
libnvme-1.16.1/src/nvme/types.h:10137: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#10135|   
#10136|   	/* Migration Send - Suspend */
#10137|-> 	NVME_LM_DUDMQ					= 1 << 31,
#10138|   	NVME_LM_STYPE_SHIFT				= 16,
#10139|   	NVME_LM_STYPE_MASK				= 0xff,

Error: CPPCHECK_WARNING (CWE-404): [#def154]
libnvme-1.16.1/src/nvme/util.c:798: error[resourceLeak]: Resource leak: file
#  796|   
#  797|   	if (!p)
#  798|-> 		return 0;
#  799|   
#  800|   	 /* Strip unwanted trailing chars */

Error: CPPCHECK_WARNING (CWE-404): [#def155]
libnvme-1.16.1/src/nvme/util.c:804: error[resourceLeak]: Resource leak: file
#  802|   	*bufsz -= len;
#  803|   
#  804|-> 	return len;
#  805|   }
#  806|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def156]
libnvme-1.16.1/test/ioctl/ana.c:89:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:87:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:89:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:89:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   87|   	struct nvme_ana_log *log = malloc(len);
#   88|   
#   89|-> 	arbitrary(log, len);
#   90|   	arbitrary(&header, sizeof(header));
#   91|   	header.ngrps = cpu_to_le16(1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def157]
libnvme-1.16.1/test/ioctl/ana.c:128:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:126:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:128:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:128:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  126|   	struct nvme_ana_log *log = malloc(len);
#  127|   
#  128|-> 	arbitrary(log, len);
#  129|   	arbitrary(&header, sizeof(header));
#  130|   	header.ngrps = cpu_to_le16(1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def158]
libnvme-1.16.1/test/ioctl/ana.c:170:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:168:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:170:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:170:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  168|   	struct nvme_ana_log *log = malloc(len);
#  169|   
#  170|-> 	arbitrary(log, len);
#  171|   	arbitrary(&header, sizeof(header));
#  172|   	header.ngrps = cpu_to_le16(ARRAY_SIZE(groups));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def159]
libnvme-1.16.1/test/ioctl/ana.c:217:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:215:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:217:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:217:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  215|   	struct nvme_ana_log *log = malloc(len);
#  216|   
#  217|-> 	arbitrary(log, len);
#  218|   	arbitrary(&header, sizeof(header));
#  219|   	header.ngrps = cpu_to_le16(3);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def160]
libnvme-1.16.1/test/ioctl/ana.c:307:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:305:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:307:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:307:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  305|   	struct nvme_ana_log *log = malloc(len);
#  306|   
#  307|-> 	arbitrary(log, len);
#  308|   	arbitrary(&header, sizeof(header));
#  309|   	header.ngrps = cpu_to_le16(1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def161]
libnvme-1.16.1/test/ioctl/ana.c:378:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:376:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:378:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:378:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  376|   	struct nvme_ana_log *log = malloc(len);
#  377|   
#  378|-> 	arbitrary(log, len);
#  379|   	arbitrary(&header1, sizeof(header1));
#  380|   	header1.ngrps = cpu_to_le16(ARRAY_SIZE(groups1));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def162]
libnvme-1.16.1/test/ioctl/ana.c:452:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:450:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:452:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:452:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#  450|   	struct nvme_ana_log *log = malloc(len);
#  451|   
#  452|-> 	arbitrary(log, len);
#  453|   	arbitrary(&header1, sizeof(header1));
#  454|   	header1.ngrps = cpu_to_le16(2);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def163]
libnvme-1.16.1/test/ioctl/ana.c:552:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:550:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:552:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:552:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#  550|   	struct nvme_ana_log *log = malloc(len);
#  551|   
#  552|-> 	arbitrary(log, len);
#  553|   	arbitrary(&header1, sizeof(header1));
#  554|   	header1.ngrps = cpu_to_le16(1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def164]
libnvme-1.16.1/test/ioctl/ana.c:602:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.16.1/test/ioctl/ana.c:600:36: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/ana.c:602:9: throw: if ‘arbitrary’ throws an exception...
libnvme-1.16.1/test/ioctl/ana.c:602:9: danger: ‘log’ leaks here; was allocated at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  600|   	struct nvme_ana_log *log = malloc(len);
#  601|   
#  602|-> 	arbitrary(log, len);
#  603|   	arbitrary(&header, sizeof(header));
#  604|   	header.ngrps = cpu_to_le16(1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def165]
libnvme-1.16.1/test/ioctl/identify.c:97:9: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnvme-1.16.1/test/ioctl/identify.c:95:14: acquire_memory: allocated here
libnvme-1.16.1/test/ioctl/identify.c:96:9: branch_true: following ‘true’ branch (when ‘id’ is non-NULL)...
libnvme-1.16.1/test/ioctl/identify.c:97:9: branch_true: ...to here
libnvme-1.16.1/test/ioctl/identify.c:97:9: throw: if ‘set_mock_admin_cmds’ throws an exception...
libnvme-1.16.1/test/ioctl/identify.c:97:9: danger: ‘id’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   95|   	id = calloc(1, NVME_IDENTIFY_DATA_SIZE);
#   96|   	check(id, "memory allocation failed");
#   97|-> 	set_mock_admin_cmds(&mock_admin_cmd, 1);
#   98|   	err = nvme_identify_ns_descs(TEST_FD, TEST_NSID, id);
#   99|   	end_mock_cmds();

Error: CPPCHECK_WARNING (CWE-758): [#def166]
libnvme-1.16.1/test/ioctl/misc.c:1221: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1219|   			 ((args.dtype & 0xf) << 20) |
# 1220|   			 ((args.prinfow & 0xf) << 26) |
# 1221|-> 			 ((args.fua & 0x1) << 30) | ((args.lr & 0x1) << 31),
# 1222|   		.data_len = args.nr * sizeof(struct nvme_copy_range),
# 1223|   		.in_data = args.copy,

Error: GCC_ANALYZER_WARNING (CWE-457): [#def167]
libnvme-1.16.1/test/ioctl/util.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘expected_lbas’
libnvme-1.16.1/test/ioctl/misc.c:413:9: branch_false: following ‘false’ branch...
libnvme-1.16.1/test/ioctl/misc.c:413:9: branch_false: ...to here
libnvme-1.16.1/test/ioctl/misc.c:413:9: throw: if ‘fail’ throws an exception...
libnvme-1.16.1/test/ioctl/misc.c:410:48: call_function: inlined call to ‘freep’ from ‘test_get_lba_status’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def168]
libnvme-1.16.1/test/ioctl/util.h:24:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘expected_status’
libnvme-1.16.1/test/ioctl/misc.c:655:9: branch_false: following ‘false’ branch...
libnvme-1.16.1/test/ioctl/misc.c:655:9: branch_false: ...to here
libnvme-1.16.1/test/ioctl/misc.c:655:9: throw: if ‘fail’ throws an exception...
libnvme-1.16.1/test/ioctl/misc.c:650:62: call_function: inlined call to ‘freep’ from ‘test_directive_recv_stream_status’
#   22|   static inline void freep(void *p)
#   23|   {
#   24|-> 	free(*(void **)p);
#   25|   }
#   26|   #define _cleanup_free_ __cleanup__(freep)

Error: CPPCHECK_WARNING (CWE-562): [#def169]
libnvme-1.16.1/test/mi-mctp.c:551: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  549|   
#  550|   	peer->tx_fn = tx_mpr;
#  551|-> 	peer->tx_data = &tx_info;
#  552|   
#  553|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def170]
libnvme-1.16.1/test/mi-mctp.c:569: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  567|   
#  568|   	peer->tx_fn = tx_mpr;
#  569|-> 	peer->tx_data = &tx_info;
#  570|   
#  571|   	ctrl = nvme_mi_init_ctrl(ep, 1);

Error: CPPCHECK_WARNING (CWE-562): [#def171]
libnvme-1.16.1/test/mi-mctp.c:594: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  592|   
#  593|   	peer->tx_fn = tx_mpr;
#  594|-> 	peer->tx_data = &tx_info;
#  595|   
#  596|   	ctrl = nvme_mi_init_ctrl(ep, 1);

Error: CPPCHECK_WARNING (CWE-562): [#def172]
libnvme-1.16.1/test/mi-mctp.c:683: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  681|   
#  682|   	peer->tx_fn = tx_fn_mpr_poll;
#  683|-> 	peer->tx_data = &tx_info;
#  684|   
#  685|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def173]
libnvme-1.16.1/test/mi-mctp.c:686: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  684|   
#  685|   	peer->poll_fn = poll_fn_mpr_poll;
#  686|-> 	peer->poll_data = &poll_info;
#  687|   
#  688|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def174]
libnvme-1.16.1/test/mi-mctp.c:712: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  710|   
#  711|   	peer->tx_fn = tx_fn_mpr_poll;
#  712|-> 	peer->tx_data = &tx_info;
#  713|   
#  714|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def175]
libnvme-1.16.1/test/mi-mctp.c:715: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  713|   
#  714|   	peer->poll_fn = poll_fn_mpr_poll;
#  715|-> 	peer->poll_data = &poll_info;
#  716|   
#  717|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def176]
libnvme-1.16.1/test/mi-mctp.c:741: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  739|   
#  740|   	peer->tx_fn = tx_fn_mpr_poll;
#  741|-> 	peer->tx_data = &tx_info;
#  742|   
#  743|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def177]
libnvme-1.16.1/test/mi-mctp.c:744: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  742|   
#  743|   	peer->poll_fn = poll_fn_mpr_poll;
#  744|-> 	peer->poll_data = &poll_info;
#  745|   
#  746|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def178]
libnvme-1.16.1/test/mi-mctp.c:1164: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1162|   
# 1163|   	config.aem_handler = aem_handler;
# 1164|-> 	peer->tx_data = (void *) &fn_data;
# 1165|   	peer->tx_fn = aem_rcv_enable_fn;
# 1166|   

Error: CPPCHECK_WARNING (CWE-562): [#def179]
libnvme-1.16.1/test/mi-mctp.c:1267: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1265|   
# 1266|   	test_peer.tx_fn = aem_rcv_enable_fn;
# 1267|-> 	peer->tx_data = (void *) &fn_data;
# 1268|   	fn_data.ep_enabled_map.enabled[8] = true;
# 1269|   	fn_data.ep_enabled_map.enabled[20] = true;

Error: CPPCHECK_WARNING (CWE-562): [#def180]
libnvme-1.16.1/test/mi-mctp.c:1285: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1283|   
# 1284|   	test_peer.tx_fn = aem_rcv_enable_fn;
# 1285|-> 	peer->tx_data = (void *) &fn_data;
# 1286|   
# 1287|   	aem_test_aem_disable_helper(ep, &fn_data);

Error: CPPCHECK_WARNING (CWE-562): [#def181]
libnvme-1.16.1/test/mi-mctp.c:1303: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1301|   	config.aemd = 1;
# 1302|   	config.aerd = 2;
# 1303|-> 	peer->tx_data = (void *) &fn_data;
# 1304|   	config.aem_handler = aem_handler;
# 1305|   

Error: CPPCHECK_WARNING (CWE-562): [#def182]
libnvme-1.16.1/test/mi-mctp.c:1349: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1347|   	config.aemd = 1;
# 1348|   	config.aerd = 2;
# 1349|-> 	peer->tx_data = (void *) &fn_data;
# 1350|   	config.aem_handler = aem_handler;
# 1351|   

Error: CPPCHECK_WARNING (CWE-457): [#def183]
libnvme-1.16.1/test/mi.c:1013: warning[uninitvar]: Uninitialized variable: exp
# 1011|   	assert(args.data_len == sizeof(tstamp));
# 1012|   	assert(tstamp.attr == 1);
# 1013|-> 	assert(!memcmp(tstamp.timestamp, exp, sizeof(tstamp.timestamp)));
# 1014|   }
# 1015|   

Error: CPPCHECK_WARNING (CWE-476): [#def184]
libnvme-1.16.1/test/mock-ifaddrs.c:38: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: storage
#   36|   
#   37|   	p = &storage->ifa;
#   38|-> 	p->ifa_next = last ? NULL : &storage[1].ifa;
#   39|   	p->ifa_name = storage->name;
#   40|   	strcpy(p->ifa_name, ifname);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def185]
libnvme-1.16.1/test/mock-ifaddrs.c:38:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘storage’
libnvme-1.16.1/test/mock-ifaddrs.c:107:45: acquire_memory: this call could return NULL
libnvme-1.16.1/test/mock-ifaddrs.c:110:9: call_function: inlined call to ‘init_entry’ from ‘getifaddrs’
#   36|   
#   37|   	p = &storage->ifa;
#   38|-> 	p->ifa_next = last ? NULL : &storage[1].ifa;
#   39|   	p->ifa_name = storage->name;
#   40|   	strcpy(p->ifa_name, ifname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def186]
libnvme-1.16.1/test/mock-ifaddrs.c:117:16: warning[-Wanalyzer-malloc-leak]: leak of ‘storage’
/usr/include/ifaddrs.h:66:12: enter_function: entry to ‘getifaddrs’
libnvme-1.16.1/test/mock-ifaddrs.c:107:45: acquire_memory: allocated here
libnvme-1.16.1/test/mock-ifaddrs.c:110:9: call_function: inlined call to ‘init_entry’ from ‘getifaddrs’
libnvme-1.16.1/test/mock-ifaddrs.c:111:9: call_function: calling ‘init_entry’ from ‘getifaddrs’
libnvme-1.16.1/test/mock-ifaddrs.c:111:9: return_function: returning to ‘getifaddrs’ from ‘init_entry’
libnvme-1.16.1/test/mock-ifaddrs.c:115:9: call_function: calling ‘init_entry’ from ‘getifaddrs’
libnvme-1.16.1/test/mock-ifaddrs.c:115:9: return_function: returning to ‘getifaddrs’ from ‘init_entry’
libnvme-1.16.1/test/mock-ifaddrs.c:117:16: danger: ‘storage’ leaks here; was allocated at [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#  115|   	init_entry(&storage[3], "lo", AF_INET6, 0, 0, 0, 1, true); /* ::1 */
#  116|   
#  117|-> 	return 0;
#  118|   }
#  119|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def187]
libnvme-1.16.1/test/zns.c:32:13: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:32:13: throw: if ‘nvme_ns_get_fd’ throws an exception...
libnvme-1.16.1/test/zns.c:32:13: danger: ‘zr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#   30|   		return;
#   31|   
#   32|-> 	if (nvme_zns_identify_ns(nvme_ns_get_fd(n), nvme_ns_get_nsid(n),
#   33|   				 &zns_ns)) {
#   34|   		fprintf(stderr, "failed to identify zns ns\n");;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def188]
libnvme-1.16.1/test/zns.c:32:53: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:32:53: throw: if ‘nvme_ns_get_nsid’ throws an exception...
libnvme-1.16.1/test/zns.c:32:53: danger: ‘zr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#   30|   		return;
#   31|   
#   32|-> 	if (nvme_zns_identify_ns(nvme_ns_get_fd(n), nvme_ns_get_nsid(n),
#   33|   				 &zns_ns)) {
#   34|   		fprintf(stderr, "failed to identify zns ns\n");;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def189]
libnvme-1.16.1/test/zns.c:41:13: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:41:13: throw: if ‘nvme_ns_get_fd’ throws an exception...
libnvme-1.16.1/test/zns.c:41:13: danger: ‘zr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#   39|   		le32_to_cpu(zns_ns.mor));
#   40|   
#   41|-> 	if (nvme_zns_identify_ctrl(nvme_ns_get_fd(n), &zns_ctrl)) {
#   42|   		fprintf(stderr, "failed to identify zns ctrl\n");;
#   43|   		free(zr);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def190]
libnvme-1.16.1/test/zns.c:49:13: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:41:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/test/zns.c:47:29: branch_false: ...to here
libnvme-1.16.1/test/zns.c:49:13: throw: if ‘nvme_ns_get_fd’ throws an exception...
libnvme-1.16.1/test/zns.c:49:13: danger: ‘zr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#   47|   	printf("zasl:%u\n", zns_ctrl.zasl);
#   48|   
#   49|-> 	if (nvme_zns_report_zones(nvme_ns_get_fd(n), nvme_ns_get_nsid(n), 0,
#   50|   				  NVME_ZNS_ZRAS_REPORT_ALL, false,
#   51|   				  true, 0x1000, (void *)zr,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def191]
libnvme-1.16.1/test/zns.c:49:54: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.16.1/test/zns.c:28:14: acquire_memory: allocated here
libnvme-1.16.1/test/zns.c:29:12: branch_false: following ‘false’ branch (when ‘zr’ is non-NULL)...
libnvme-1.16.1/test/zns.c:32:53: branch_false: ...to here
libnvme-1.16.1/test/zns.c:41:12: branch_false: following ‘false’ branch...
libnvme-1.16.1/test/zns.c:47:29: branch_false: ...to here
libnvme-1.16.1/test/zns.c:49:54: throw: if ‘nvme_ns_get_nsid’ throws an exception...
libnvme-1.16.1/test/zns.c:49:54: danger: ‘zr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#   47|   	printf("zasl:%u\n", zns_ctrl.zasl);
#   48|   
#   49|-> 	if (nvme_zns_report_zones(nvme_ns_get_fd(n), nvme_ns_get_nsid(n), 0,
#   50|   				  NVME_ZNS_ZRAS_REPORT_ALL, false,
#   51|   				  true, 0x1000, (void *)zr,

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
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-100.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-namelibnvme-1.16.1-1.fc44
store-results-to/tmp/tmpuadqilg4/libnvme-1.16.1-1.fc44.tar.xz
time-created2026-01-08 19:02:32
time-finished2026-01-08 19:05:30
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpuadqilg4/libnvme-1.16.1-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpuadqilg4/libnvme-1.16.1-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9