libnvme-1.15-4.fc44

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libnvme-1.15/examples/telemetry-listen.c:34:13: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/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-775): [#def2]
libnvme-1.15/examples/telemetry-listen.c:36:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&buf, 0)’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/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-401): [#def3]
libnvme-1.15/examples/telemetry-listen.c:36:16: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/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): [#def4]
libnvme-1.15/examples/telemetry-listen.c:48:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/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): [#def5]
libnvme-1.15/examples/telemetry-listen.c:48:15: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/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): [#def6]
libnvme-1.15/examples/telemetry-listen.c:53:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   51|   
#   52|   	s = time(NULL);
#   53|-> 	ret = snprintf(buf, sizeof(buf), "/var/log/%s-telemetry-%llu",
#   54|   		       nvme_ctrl_get_subsysnqn(c), (unsigned long long)s);
#   55|   	if (ret < 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libnvme-1.15/examples/telemetry-listen.c:53:15: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   51|   
#   52|   	s = time(NULL);
#   53|-> 	ret = snprintf(buf, sizeof(buf), "/var/log/%s-telemetry-%llu",
#   54|   		       nvme_ctrl_get_subsysnqn(c), (unsigned long long)s);
#   55|   	if (ret < 0) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def8]
libnvme-1.15/examples/telemetry-listen.c:60:14: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   58|   	}
#   59|   
#   60|-> 	fd = open(buf, O_CREAT|O_WRONLY, S_IRUSR|S_IRGRP);
#   61|   	if (fd < 0) {
#   62|   		free(log);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
libnvme-1.15/examples/telemetry-listen.c:60:14: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   58|   	}
#   59|   
#   60|-> 	fd = open(buf, O_CREAT|O_WRONLY, S_IRUSR|S_IRGRP);
#   61|   	if (fd < 0) {
#   62|   		free(log);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
libnvme-1.15/examples/telemetry-listen.c:66:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   64|   	}
#   65|   
#   66|-> 	ret = write(fd, log, log_size);
#   67|   	if (ret < 0)
#   68|   		printf("failed to write telemetry log\n");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
libnvme-1.15/examples/telemetry-listen.c:66:15: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:164:9: call_function: calling ‘wait_events’ from ‘main’
#   64|   	}
#   65|   
#   66|-> 	ret = write(fd, log, log_size);
#   67|   	if (ret < 0)
#   68|   		printf("failed to write telemetry log\n");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def12]
libnvme-1.15/examples/telemetry-listen.c:97:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/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): [#def13]
libnvme-1.15/examples/telemetry-listen.c:97:17: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/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): [#def14]
libnvme-1.15/examples/telemetry-listen.c:113:23: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/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-775): [#def15]
libnvme-1.15/examples/telemetry-listen.c:149:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: danger: leaks here; was opened at [(14)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/13)
#  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): [#def16]
libnvme-1.15/examples/telemetry-listen.c:149:9: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: danger: ‘e’ leaks here; was allocated at [(3)](sarif:/runs/0/results/16/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): [#def17]
libnvme-1.15/examples/telemetry-listen.c:150:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: danger: leaks here; was opened at [(14)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/13)
#  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): [#def18]
libnvme-1.15/examples/telemetry-listen.c:150:17: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: danger: ‘e’ leaks here; was allocated at [(3)](sarif:/runs/0/results/20/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): [#def19]
libnvme-1.15/examples/telemetry-listen.c:151:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_false: following ‘false’ branch (when ‘c’ is NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: danger: leaks here; was opened at [(14)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/13)
#  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): [#def20]
libnvme-1.15/examples/telemetry-listen.c:151:25: warning[-Wanalyzer-malloc-leak]: leak of ‘e’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: allocated here
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: danger: ‘e’ leaks here; was allocated at [(3)](sarif:/runs/0/results/26/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): [#def21]
libnvme-1.15/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-476): [#def22]
libnvme-1.15/examples/telemetry-listen.c:157:33: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘e’
libnvme-1.15/examples/telemetry-listen.c:125:5: enter_function: entry to ‘main’
libnvme-1.15/examples/telemetry-listen.c:137:12: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:140:9: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:145:13: acquire_memory: this call could return NULL
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: following ‘true’ branch (when ‘__i != 16’)...
libnvme-1.15/examples/telemetry-listen.c:146:9: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:149:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:150:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:151:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/examples/telemetry-listen.c:152:42: branch_true: ...to here
libnvme-1.15/examples/telemetry-listen.c:152:42: call_function: calling ‘open_uevent’ from ‘main’
libnvme-1.15/examples/telemetry-listen.c:152:42: return_function: returning to ‘main’ from ‘open_uevent’
libnvme-1.15/examples/telemetry-listen.c:154:36: branch_false: following ‘false’ branch...
libnvme-1.15/examples/telemetry-listen.c:156:33: branch_false: ...to here
libnvme-1.15/examples/telemetry-listen.c:157:33: danger: ‘e + (long unsigned int)i * 16’ could be NULL: unchecked value from [(4)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/3)
#  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): [#def23]
libnvme-1.15/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: CPPCHECK_WARNING (CWE-457): [#def24]
libnvme-1.15/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): [#def25]
libnvme-1.15/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: CPPCHECK_WARNING (CWE-476): [#def26]
libnvme-1.15/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.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.15/src/nvme/tree.c:1873:12: enter_function: entry to ‘nvme_ctrl_scan_paths’
libnvme-1.15/src/nvme/tree.c:1878:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/tree.c:1883:21: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1884:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1887:21: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/tree.c:1888:43: branch_true: ...to here
libnvme-1.15/src/nvme/tree.c:1888:17: call_function: calling ‘nvme_ctrl_scan_path’ from ‘nvme_ctrl_scan_paths’
#   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): [#def28]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘head’
libnvme-1.15/src/nvme/tree.c:2802:18: enter_function: entry to ‘nvme_ns_open’
libnvme-1.15/src/nvme/tree.c:2811:12: branch_false: following ‘false’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/src/nvme/tree.c:2816:16: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2816:16: acquire_memory: allocated here
libnvme-1.15/src/nvme/tree.c:2817:12: branch_false: following ‘false’ branch (when ‘head’ is non-NULL)...
libnvme-1.15/src/nvme/tree.c:2823:9: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2826:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.15/src/nvme/tree.c:2834:15: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2835:12: branch_true: following ‘true’ branch (when ‘ret == 0’)...
libnvme-1.15/src/nvme/tree.c:2836:17: branch_true: ...to here
libnvme-1.15/src/nvme/tree.c:2845:9: call_function: calling ‘nvme_ns_set_generic_name’ from ‘nvme_ns_open’
libnvme-1.15/src/nvme/tree.c:2845:9: return_function: returning to ‘nvme_ns_open’ from ‘nvme_ns_set_generic_name’
libnvme-1.15/src/nvme/tree.c:2847:13: call_function: calling ‘nvme_ns_init’ from ‘nvme_ns_open’
libnvme-1.15/src/nvme/tree.c:2808: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): [#def29]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘identity’
libnvme-1.15/src/nvme/linux.c:1102:7: enter_function: entry to ‘nvme_generate_tls_key_identity’
libnvme-1.15/src/nvme/linux.c:1112:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:1115:20: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:1115:20: acquire_memory: allocated here
libnvme-1.15/src/nvme/linux.c:1116:12: branch_false: following ‘false’ branch (when ‘identity’ is non-NULL)...
libnvme-1.15/src/nvme/linux.c:1119:15: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:1120:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:1123:9: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:1124:15: call_function: calling ‘derive_nvme_keys’ from ‘nvme_generate_tls_key_identity’
libnvme-1.15/src/nvme/linux.c:1106:39: call_function: inlined call to ‘freep’ from ‘nvme_generate_tls_key_identity’
#   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): [#def30]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘n’
libnvme-1.15/src/nvme/tree.c:2802:18: enter_function: entry to ‘nvme_ns_open’
libnvme-1.15/src/nvme/tree.c:2810:13: acquire_memory: allocated here
libnvme-1.15/src/nvme/tree.c:2811:12: branch_false: following ‘false’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/src/nvme/tree.c:2816:16: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2817:12: branch_false: following ‘false’ branch (when ‘head’ is non-NULL)...
libnvme-1.15/src/nvme/tree.c:2823:9: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2826:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.15/src/nvme/tree.c:2834:15: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2835:12: branch_true: following ‘true’ branch (when ‘ret == 0’)...
libnvme-1.15/src/nvme/tree.c:2836:17: branch_true: ...to here
libnvme-1.15/src/nvme/tree.c:2845:9: call_function: calling ‘nvme_ns_set_generic_name’ from ‘nvme_ns_open’
libnvme-1.15/src/nvme/tree.c:2845:9: return_function: returning to ‘nvme_ns_open’ from ‘nvme_ns_set_generic_name’
libnvme-1.15/src/nvme/tree.c:2847:13: call_function: calling ‘nvme_ns_init’ from ‘nvme_ns_open’
libnvme-1.15/src/nvme/tree.c:2808: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): [#def31]
libnvme-1.15/src/nvme/cleanup.h:24:9: warning[-Wanalyzer-malloc-leak]: leak of ‘p’
libnvme-1.15/src/nvme/tree.c:1873:12: enter_function: entry to ‘nvme_ctrl_scan_paths’
libnvme-1.15/src/nvme/tree.c:1878:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/tree.c:1883:21: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1884:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1887:21: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/tree.c:1888:43: branch_true: ...to here
libnvme-1.15/src/nvme/tree.c:1888:17: call_function: calling ‘nvme_ctrl_scan_path’ from ‘nvme_ctrl_scan_paths’
#   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): [#def32]
libnvme-1.15/src/nvme/cleanup.h:31:15: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.15/src/nvme/tree.c:1938:14: enter_function: entry to ‘nvme_ctrl_lookup_phy_slot’
libnvme-1.15/src/nvme/tree.c:1946:12: branch_false: following ‘false’ branch (when ‘address’ is non-NULL)...
libnvme-1.15/src/nvme/tree.c:1949:21: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1950:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/tree.c:1956:23: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1957:16: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/tree.c:1958:21: branch_true: ...to here
libnvme-1.15/src/nvme/tree.c:1966:28: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.15/src/nvme/tree.c:1970:32: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:1976:40: acquire_memory: allocated here
libnvme-1.15/src/nvme/tree.c:1942: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): [#def33]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/urandom", 0)’
libnvme-1.15/src/nvme/util.c:957:5: enter_function: entry to ‘nvme_uuid_random’
libnvme-1.15/src/nvme/util.c:962:13: acquire_resource: opened here
libnvme-1.15/src/nvme/util.c:963:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/util.c:965:13: branch_false: ...to here
libnvme-1.15/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): [#def34]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(f, 0)’
libnvme-1.15/src/nvme/fabrics.c:1468:14: enter_function: entry to ‘nvmf_read_file’
libnvme-1.15/src/nvme/fabrics.c:1474:14: acquire_resource: opened here
libnvme-1.15/src/nvme/fabrics.c:1475:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1478:9: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1471: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-775): [#def35]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvme_uuid_ibm_filename(), 0)’
libnvme-1.15/src/nvme/fabrics.c:1274:12: enter_function: entry to ‘uuid_from_device_tree’
libnvme-1.15/src/nvme/fabrics.c:1279:13: acquire_resource: opened here
libnvme-1.15/src/nvme/fabrics.c:1280:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1283:9: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1276: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): [#def36]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(nvmf_dev, 0)’
libnvme-1.15/src/nvme/fabrics.c:1004:13: enter_function: entry to ‘nvmf_connect_disc_entry’
libnvme-1.15/src/nvme/fabrics.c:1054:21: call_function: calling ‘nvmf_trtype_str’ from ‘nvmf_connect_disc_entry’
libnvme-1.15/src/nvme/fabrics.c:1054:21: return_function: returning to ‘nvmf_connect_disc_entry’ from ‘nvmf_trtype_str’
libnvme-1.15/src/nvme/fabrics.c:1061:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1069:17: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1092:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1098:13: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1098:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/fabrics.c:1099:13: branch_true: ...to here
libnvme-1.15/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-775): [#def37]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path, 1)’
libnvme-1.15/src/nvme/linux.c:434:12: enter_function: entry to ‘__nvme_set_attr’
libnvme-1.15/src/nvme/linux.c:438:14: acquire_resource: opened here
libnvme-1.15/src/nvme/linux.c:439:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:446:16: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:436:26: call_function: inlined call to ‘cleanup_fd’ from ‘__nvme_set_attr’
#   35|   {
#   36|   	if (*fd >= 0)
#   37|-> 		close(*fd);
#   38|   }
#   39|   #define _cleanup_fd_ __cleanup__(cleanup_fd)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def38]
libnvme-1.15/src/nvme/cleanup.h:37:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.15/src/nvme/fabrics.c:1468:14: enter_function: entry to ‘nvmf_read_file’
libnvme-1.15/src/nvme/fabrics.c:1475:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1478:9: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1481:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1483:16: acquire_memory: allocated here
libnvme-1.15/src/nvme/fabrics.c:1471: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): [#def39]
libnvme-1.15/src/nvme/fabrics.c:724:12: warning[-Wanalyzer-malloc-leak]: leak of ‘*((struct nvme_root *)r).options’
libnvme-1.15/src/nvme/fabrics.c:1004:13: enter_function: entry to ‘nvmf_connect_disc_entry’
libnvme-1.15/src/nvme/fabrics.c:1054:21: call_function: calling ‘nvmf_trtype_str’ from ‘nvmf_connect_disc_entry’
libnvme-1.15/src/nvme/fabrics.c:1054:21: return_function: returning to ‘nvmf_connect_disc_entry’ from ‘nvmf_trtype_str’
libnvme-1.15/src/nvme/fabrics.c:1061:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1069:17: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1092:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1098:13: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1098:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/fabrics.c:1099:13: branch_true: ...to here
libnvme-1.15/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): [#def40]
libnvme-1.15/src/nvme/fabrics.c:1339:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.15/src/nvme/fabrics.c:1326:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1328:16: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/fabrics.c:1332:21: branch_true: ...to here
libnvme-1.15/src/nvme/fabrics.c:1332:20: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1334:62: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1335:21: acquire_resource: opened here
libnvme-1.15/src/nvme/fabrics.c:1336:20: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1338:23: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1339:17: danger: ‘open(&filename, 0)’ leaks here; was opened at [(7)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/6)
# 1337|   			continue;
# 1338|   		len = read(f, buf, 512);
# 1339|-> 		close(f);
# 1340|   		if (len <= 0)
# 1341|   			continue;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def41]
libnvme-1.15/src/nvme/fabrics.c:1351:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&filename, 0)’
libnvme-1.15/src/nvme/fabrics.c:1326:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1328:16: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/fabrics.c:1332:21: branch_true: ...to here
libnvme-1.15/src/nvme/fabrics.c:1347:21: acquire_resource: opened here
libnvme-1.15/src/nvme/fabrics.c:1351:17: danger: ‘open(&filename, 0)’ leaks here; was opened at [(5)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/4)
# 1349|   			continue;
# 1350|   		len = read(f, buf, 512);
# 1351|-> 		close(f);
# 1352|   		if (len <= 0)
# 1353|   			continue;

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

Error: GCC_ANALYZER_WARNING (CWE-401): [#def43]
libnvme-1.15/src/nvme/fabrics.c:1827:22: warning[-Wanalyzer-malloc-leak]: leak of ‘unescape_uri(elem, 0)’
libnvme-1.15/src/nvme/fabrics.c:1841:26: enter_function: entry to ‘nvme_parse_uri’
libnvme-1.15/src/nvme/fabrics.c:1865:12: branch_false: following ‘false’ branch (when ‘uri’ is non-NULL)...
libnvme-1.15/src/nvme/fabrics.c:1868:13: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1868:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1875:13: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1875:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1883:16: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1891:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1904:13: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1904:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/fabrics.c:1908:21: branch_true: ...to here
libnvme-1.15/src/nvme/fabrics.c:1909:20: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1914:21: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1915:20: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/fabrics.c:1921:29: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1928:20: branch_true: following ‘true’ branch (when ‘elem’ is non-NULL)...
libnvme-1.15/src/nvme/fabrics.c:1929:25: branch_true: ...to here
libnvme-1.15/src/nvme/fabrics.c:1929:51: call_function: calling ‘unescape_uri’ from ‘nvme_parse_uri’
libnvme-1.15/src/nvme/fabrics.c:1929:51: return_function: returning to ‘nvme_parse_uri’ from ‘unescape_uri’
libnvme-1.15/src/nvme/fabrics.c:1827:22: danger: ‘unescape_uri(elem, 0)’ leaks here; was allocated at [(22)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/21)
# 1825|   
# 1826|   	l = len > 0 ? len : strlen(str);
# 1827|-> 	dst = malloc(l + 1);
# 1828|   	for (i = 0, j = 0; i < l; i++, j++) {
# 1829|   		if (str[i] == '%' && i + 2 < l &&

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

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

Error: CPPCHECK_WARNING (CWE-476): [#def46]
libnvme-1.15/src/nvme/fabrics.c:1837: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dst
# 1835|   			dst[j] = str[i];
# 1836|   	}
# 1837|-> 	dst[j] = '\0';
# 1838|   	return dst;
# 1839|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def47]
libnvme-1.15/src/nvme/fabrics.c:1837:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dst’
libnvme-1.15/src/nvme/fabrics.c:1826:9: branch_true: following ‘true’ branch (when ‘len <= 0’)...
libnvme-1.15/src/nvme/fabrics.c:1826:29: branch_true: ...to here
libnvme-1.15/src/nvme/fabrics.c:1827:15: acquire_memory: this call could return NULL
libnvme-1.15/src/nvme/fabrics.c:1828:28: branch_false: following ‘false’ branch (when ‘l <= i’)...
libnvme-1.15/src/nvme/fabrics.c:1837:12: branch_false: ...to here
libnvme-1.15/src/nvme/fabrics.c:1837:9: danger: ‘dst + (sizetype)j’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/2)
# 1835|   			dst[j] = str[i];
# 1836|   	}
# 1837|-> 	dst[j] = '\0';
# 1838|   	return dst;
# 1839|   }

Error: CPPCHECK_WARNING (CWE-758): [#def48]
libnvme-1.15/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): [#def49]
libnvme-1.15/src/nvme/ioctl.h:608:16: warning[-Wanalyzer-malloc-leak]: leak of ‘descs’
libnvme-1.15/test/test.c:274:12: enter_function: entry to ‘test_namespace’
libnvme-1.15/test/test.c:283:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/test.c:286:9: branch_false: ...to here
libnvme-1.15/test/test.c:296:17: acquire_memory: allocated here
libnvme-1.15/test/test.c:297:12: branch_false: following ‘false’ branch (when ‘descs’ is non-NULL)...
libnvme-1.15/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): [#def50]
libnvme-1.15/src/nvme/ioctl.h:608:16: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnvme-1.15/test/ioctl/identify.c:81:13: enter_function: entry to ‘test_ns_descs’
libnvme-1.15/test/ioctl/identify.c:95:14: acquire_memory: allocated here
libnvme-1.15/test/ioctl/identify.c:96:9: branch_true: following ‘true’ branch (when ‘id’ is non-NULL)...
libnvme-1.15/test/ioctl/identify.c:97:9: branch_true: ...to here
libnvme-1.15/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): [#def51]
libnvme-1.15/src/nvme/ioctl.h:988:16: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
#  986|   	};
#  987|   
#  988|-> 	return nvme_identify(&args);
#  989|   }
#  990|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def52]
libnvme-1.15/src/nvme/ioctl.h:1020:16: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
# 1018|   	};
# 1019|   
# 1020|-> 	return nvme_identify(&args);
# 1021|   }
# 1022|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def53]
libnvme-1.15/src/nvme/ioctl.h:4512:16: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
# 4510|   	};
# 4511|   
# 4512|-> 	return nvme_zns_mgmt_recv(&args);
# 4513|   }
# 4514|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def54]
libnvme-1.15/src/nvme/json.c:251:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(config_file, 0)’
libnvme-1.15/src/nvme/json.c:238:5: enter_function: entry to ‘json_read_config’
libnvme-1.15/src/nvme/json.c:243:14: acquire_resource: opened here
libnvme-1.15/src/nvme/json.c:244:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/json.c:249:21: branch_false: ...to here
libnvme-1.15/src/nvme/json.c:249:21: call_function: calling ‘parse_json’ from ‘json_read_config’
libnvme-1.15/src/nvme/json.c:249:21: return_function: returning to ‘json_read_config’ from ‘parse_json’
libnvme-1.15/src/nvme/json.c:251:12: danger: ‘open(config_file, 0)’ leaks here; was opened at [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
#  249|   	json_root = parse_json(r, fd);
#  250|   	close(fd);
#  251|-> 	if (!json_root) {
#  252|   		errno = EPROTO;
#  253|   		return -1;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def55]
libnvme-1.15/src/nvme/linux.c:474:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path, 0)’
libnvme-1.15/src/nvme/linux.c:467:14: acquire_resource: opened here
libnvme-1.15/src/nvme/linux.c:468:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:471:15: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:474:12: danger: ‘open(path, 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  472|   	saved_errno = errno;
#  473|   	close(fd);
#  474|-> 	if (ret < 0) {
#  475|   		errno = saved_errno;
#  476|   		return NULL;

Error: CPPCHECK_WARNING (CWE-401): [#def56]
libnvme-1.15/src/nvme/linux.c:1318: error[memleak]: Memory leak: identity
# 1316|   	if (!psk) {
# 1317|   		errno = ENOMEM;
# 1318|-> 		return 0;
# 1319|   	}
# 1320|   	memset(psk, 0, key_len);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def57]
libnvme-1.15/src/nvme/linux.c:1616:16: warning[-Wanalyzer-malloc-leak]: leak of ‘encoded_key’
libnvme-1.15/src/nvme/linux.c:1585:20: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/linux.c:1599:9: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:1609:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/linux.c:1610:12: branch_false: following ‘false’ branch (when ‘encoded_key’ is non-NULL)...
libnvme-1.15/src/nvme/linux.c:1614:9: branch_false: ...to here
libnvme-1.15/src/nvme/linux.c:1616:16: danger: ‘encoded_key’ leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
# 1614|   	memset(encoded_key, 0, encoded_len);
# 1615|   	len = sprintf(encoded_key, "NVMeTLSkey-%x:%02x:", version, hmac);
# 1616|-> 	len += base64_encode(raw_secret, raw_len, encoded_key + len);
# 1617|   	encoded_key[len++] = ':';
# 1618|   	encoded_key[len++] = '\0';

Error: GCC_ANALYZER_WARNING (CWE-775): [#def58]
libnvme-1.15/src/nvme/mi-mctp.c:146:14: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘sd’
libnvme-1.15/src/nvme/mi-mctp.c:137:14: acquire_resource: socket created here
libnvme-1.15/src/nvme/mi-mctp.c:138:12: branch_false: following ‘false’ branch (when ‘sd >= 0’)...
libnvme-1.15/src/nvme/mi-mctp.c:141:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:146:14: danger: ‘sd’ leaks here
#  144|   	remote_addr.smctp_type = MCTP_TYPE_NVME;
#  145|   	/* connect() will specify a remote EID for the upcoming bind() */
#  146|-> 	rc = connect(sd, (struct sockaddr *)&remote_addr, sizeof(remote_addr));
#  147|   	if (rc)
#  148|   		goto err_close;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def59]
libnvme-1.15/src/nvme/mi-mctp.c:535:14: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.15/src/nvme/mi-mctp.c:453:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:459:13: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:459:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:464:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:497:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:506:20: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:507:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:508:29: branch_true: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:509:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.15/src/nvme/mi-mctp.c:517:17: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:535:14: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/8)
#  533|   	timeout = ep->timeout ?: -1;
#  534|   retry:
#  535|-> 	rc = ops.poll(pollfds, 1, timeout);
#  536|   	if (rc < 0) {
#  537|   		if (errno == EINTR)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def60]
libnvme-1.15/src/nvme/mi-mctp.c:540:17: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.15/src/nvme/mi-mctp.c:453:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:459:13: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:459:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:464:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:497:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:506:20: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:507:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:508:29: branch_true: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:509:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.15/src/nvme/mi-mctp.c:517:17: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:536:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:537:21: branch_true: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:540:17: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8)
#  538|   			goto retry;
#  539|   		errno_save = errno;
#  540|-> 		nvme_msg(ep->root, LOG_ERR,
#  541|   			 "Failed polling on MCTP socket: %m");
#  542|   		errno = errno_save;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def61]
libnvme-1.15/src/nvme/mi-mctp.c:547:17: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.15/src/nvme/mi-mctp.c:453:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:459:13: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:459:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:464:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:497:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:506:20: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:507:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:508:29: branch_true: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:509:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.15/src/nvme/mi-mctp.c:517:17: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:546:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:547:17: branch_true: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:547:17: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/8)
#  545|   
#  546|   	if (rc == 0) {
#  547|-> 		nvme_msg(ep->root, LOG_DEBUG, "Timeout on MCTP socket");
#  548|   		errno = ETIMEDOUT;
#  549|   		rc = -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
libnvme-1.15/src/nvme/mi-mctp.c:554:15: warning[-Wanalyzer-malloc-leak]: leak of ‘tmp’
libnvme-1.15/src/nvme/mi-mctp.c:453:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:459:13: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:459:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:464:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:497:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:506:20: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:507:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:508:29: branch_true: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:509:20: branch_false: following ‘false’ branch (when ‘tmp’ is non-NULL)...
libnvme-1.15/src/nvme/mi-mctp.c:517:17: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:546:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:554:15: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:554:15: danger: ‘tmp’ leaks here; was allocated at [(9)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/8)
#  552|   
#  553|   	rc = -1;
#  554|-> 	len = ops.recvmsg(mctp->sd, &resp_msg, MSG_DONTWAIT);
#  555|   
#  556|   	if (len < 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def63]
libnvme-1.15/src/nvme/mi-mctp.c:745:20: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libnvme-1.15/src/nvme/mi-mctp.c:715:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:718:16: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:719:12: branch_false: following ‘false’ branch (when ‘mctp’ is non-NULL)...
libnvme-1.15/src/nvme/mi-mctp.c:724:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:729:26: acquire_memory: allocated here
libnvme-1.15/src/nvme/mi-mctp.c:730:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:735:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:737:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:742:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:745:20: danger: ‘<unknown>’ leaks here; was allocated at [(5)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/4)
#  743|   	mctp->eid = eid;
#  744|   
#  745|-> 	mctp->sd = ops.msg_socket();
#  746|   	if (mctp->sd < 0) {
#  747|   		errno_save = errno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def64]
libnvme-1.15/src/nvme/mi-mctp.c:745:20: warning[-Wanalyzer-malloc-leak]: leak of ‘mctp’
libnvme-1.15/src/nvme/mi-mctp.c:715:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:718:16: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:718:16: acquire_memory: allocated here
libnvme-1.15/src/nvme/mi-mctp.c:719:12: branch_false: following ‘false’ branch (when ‘mctp’ is non-NULL)...
libnvme-1.15/src/nvme/mi-mctp.c:724:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:730:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:735:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:737:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi-mctp.c:742:9: branch_false: ...to here
libnvme-1.15/src/nvme/mi-mctp.c:745:20: danger: ‘mctp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  743|   	mctp->eid = eid;
#  744|   
#  745|-> 	mctp->sd = ops.msg_socket();
#  746|   	if (mctp->sd < 0) {
#  747|   		errno_save = errno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def65]
libnvme-1.15/src/nvme/mi.c:288:9: warning[-Wanalyzer-malloc-leak]: leak of ‘enabled_list’
libnvme-1.15/src/nvme/mi.c:2472:5: enter_function: entry to ‘nvme_mi_aem_enable’
libnvme-1.15/src/nvme/mi.c:2476:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2481:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2485:40: branch_false: ...to here
libnvme-1.15/src/nvme/mi.c:2493:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2495:14: branch_false: ...to here
libnvme-1.15/src/nvme/mi.c:2495:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2498:9: branch_false: ...to here
libnvme-1.15/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): [#def66]
libnvme-1.15/src/nvme/mi.c:288:9: warning[-Wanalyzer-malloc-leak]: leak of ‘request’
libnvme-1.15/src/nvme/mi.c:2380:12: enter_function: entry to ‘aem_sync’
libnvme-1.15/src/nvme/mi.c:2396:58: acquire_memory: allocated here
libnvme-1.15/src/nvme/mi.c:2398:12: branch_false: following ‘false’ branch (when ‘request’ is non-NULL)...
libnvme-1.15/src/nvme/mi.c:2401:9: branch_false: ...to here
libnvme-1.15/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): [#def67]
libnvme-1.15/src/nvme/mi.c:544:14: warning[-Wanalyzer-malloc-leak]: leak of ‘enabled_list’
libnvme-1.15/src/nvme/mi.c:2472:5: enter_function: entry to ‘nvme_mi_aem_enable’
libnvme-1.15/src/nvme/mi.c:2476:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2481:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2485:40: branch_false: ...to here
libnvme-1.15/src/nvme/mi.c:2493:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2495:14: branch_false: ...to here
libnvme-1.15/src/nvme/mi.c:2495:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2498:9: branch_false: ...to here
libnvme-1.15/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): [#def68]
libnvme-1.15/src/nvme/mi.c:544:14: warning[-Wanalyzer-malloc-leak]: leak of ‘request’
libnvme-1.15/src/nvme/mi.c:2380:12: enter_function: entry to ‘aem_sync’
libnvme-1.15/src/nvme/mi.c:2396:58: acquire_memory: allocated here
libnvme-1.15/src/nvme/mi.c:2398:12: branch_false: following ‘false’ branch (when ‘request’ is non-NULL)...
libnvme-1.15/src/nvme/mi.c:2401:9: branch_false: ...to here
libnvme-1.15/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): [#def69]
libnvme-1.15/src/nvme/mi.c:550:17: warning[-Wanalyzer-malloc-leak]: leak of ‘enabled_list’
libnvme-1.15/src/nvme/mi.c:2546:5: enter_function: entry to ‘nvme_mi_aem_get_enabled’
libnvme-1.15/src/nvme/mi.c:2549:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/mi.c:2555:16: branch_false: ...to here
libnvme-1.15/src/nvme/mi.c:2556:59: acquire_memory: allocated here
libnvme-1.15/src/nvme/mi.c:2558:12: branch_false: following ‘false’ branch (when ‘enabled_list’ is non-NULL)...
libnvme-1.15/src/nvme/mi.c:2561:14: branch_false: ...to here
libnvme-1.15/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): [#def70]
libnvme-1.15/src/nvme/mi.c:550:17: warning[-Wanalyzer-malloc-leak]: leak of ‘request’
libnvme-1.15/src/nvme/mi.c:2380:12: enter_function: entry to ‘aem_sync’
libnvme-1.15/src/nvme/mi.c:2396:58: acquire_memory: allocated here
libnvme-1.15/src/nvme/mi.c:2398:12: branch_false: following ‘false’ branch (when ‘request’ is non-NULL)...
libnvme-1.15/src/nvme/mi.c:2401:9: branch_false: ...to here
libnvme-1.15/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): [#def71]
libnvme-1.15/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): [#def72]
libnvme-1.15/src/nvme/nbft.c:93:17: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def73]
libnvme-1.15/src/nvme/nbft.c:93:17: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def74]
libnvme-1.15/src/nvme/nbft.c:93:17: warning[-Wanalyzer-malloc-leak]: leak of ‘ssns’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def75]
libnvme-1.15/src/nvme/nbft.c:104:25: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def76]
libnvme-1.15/src/nvme/nbft.c:111:25: warning[-Wanalyzer-malloc-leak]: leak of ‘discovery’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def77]
libnvme-1.15/src/nvme/nbft.c:224:25: warning[-Wanalyzer-malloc-leak]: leak of ‘ssns’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def78]
libnvme-1.15/src/nvme/nbft.c:346:9: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def79]
libnvme-1.15/src/nvme/nbft.c:348:9: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def80]
libnvme-1.15/src/nvme/nbft.c:351:17: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def81]
libnvme-1.15/src/nvme/nbft.c:423:17: warning[-Wanalyzer-malloc-leak]: leak of ‘hfi’
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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-131): [#def82]
libnvme-1.15/src/nvme/nbft.c:511:9: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
libnvme-1.15/src/nvme/nbft.c:689:5: enter_function: entry to ‘nvme_nbft_read’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:749:29: branch_false: ...to here
libnvme-1.15/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): [#def83]
libnvme-1.15/src/nvme/nbft.c:707:13: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:707:13: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/11/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): [#def84]
libnvme-1.15/src/nvme/nbft.c:707:13: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:707:13: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/12/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): [#def85]
libnvme-1.15/src/nvme/nbft.c:709:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/nbft.c:709:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:709:17: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/13/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): [#def86]
libnvme-1.15/src/nvme/nbft.c:709:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/nbft.c:709:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:709:17: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/14/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): [#def87]
libnvme-1.15/src/nvme/nbft.c:716:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:716:25: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/15/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): [#def88]
libnvme-1.15/src/nvme/nbft.c:716:25: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:716:25: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/16/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): [#def89]
libnvme-1.15/src/nvme/nbft.c:717:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:717:9: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/17/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): [#def90]
libnvme-1.15/src/nvme/nbft.c:717:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:717:9: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/18/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): [#def91]
libnvme-1.15/src/nvme/nbft.c:721:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_true: following ‘true’ branch (when ‘raw_nbft’ is NULL)...
libnvme-1.15/src/nvme/nbft.c:721:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:721:17: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/19/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): [#def92]
libnvme-1.15/src/nvme/nbft.c:721:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_true: following ‘true’ branch (when ‘raw_nbft’ is NULL)...
libnvme-1.15/src/nvme/nbft.c:721:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:721:17: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/20/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): [#def93]
libnvme-1.15/src/nvme/nbft.c:729:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_resource: opened here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/nbft.c:729:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:729:17: danger: ‘fopen(filename, "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/0)
#  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): [#def94]
libnvme-1.15/src/nvme/nbft.c:729:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "rb")’
libnvme-1.15/src/nvme/nbft.c:699:23: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/nbft.c:729:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:729:17: danger: ‘fopen(filename, "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
#  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): [#def95]
libnvme-1.15/src/nvme/nbft.c:729:17: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_nbft’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:719:20: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/nbft.c:729:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:729:17: danger: ‘raw_nbft’ leaks here; was allocated at [(5)](sarif:/runs/0/results/22/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): [#def96]
libnvme-1.15/src/nvme/nbft.c:743:17: warning[-Wanalyzer-malloc-leak]: leak of ‘raw_nbft’
libnvme-1.15/src/nvme/nbft.c:700:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:707:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:708:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:716:25: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:719:20: acquire_memory: allocated here
libnvme-1.15/src/nvme/nbft.c:720:12: branch_false: following ‘false’ branch (when ‘raw_nbft’ is non-NULL)...
libnvme-1.15/src/nvme/nbft.c:727:13: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:728:12: branch_false: following ‘false’ branch...
libnvme-1.15/src/nvme/nbft.c:736:9: branch_false: ...to here
libnvme-1.15/src/nvme/nbft.c:742:12: branch_true: following ‘true’ branch...
libnvme-1.15/src/nvme/nbft.c:743:17: branch_true: ...to here
libnvme-1.15/src/nvme/nbft.c:743:17: danger: ‘raw_nbft’ leaks here; was allocated at [(5)](sarif:/runs/0/results/24/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): [#def97]
libnvme-1.15/src/nvme/private.h:340:12: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(path)’
libnvme-1.15/src/nvme/tree.c:2096:5: enter_function: entry to ‘nvme_init_ctrl’
libnvme-1.15/src/nvme/tree.c:2103:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.15/src/nvme/tree.c:2107:15: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2108:12: branch_false: following ‘false’ branch (when ‘ret >= 0’)...
libnvme-1.15/src/nvme/tree.c:2113:15: branch_false: ...to here
libnvme-1.15/src/nvme/tree.c:2113:15: call_function: calling ‘nvme_reconfigure_ctrl’ from ‘nvme_init_ctrl’
#  338|   static inline char *xstrdup(const char *s)
#  339|   {
#  340|-> 	if (!s)
#  341|   		return NULL;
#  342|   	return strdup(s);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def98]
libnvme-1.15/src/nvme/tree.c:111:16: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*ents.num’
libnvme-1.15/src/nvme/tree.c:1910:14: enter_function: entry to ‘nvme_ctrl_lookup_subsystem_name’
libnvme-1.15/src/nvme/tree.c:1914:42: call_function: calling ‘cleanup_dirents’ from ‘nvme_ctrl_lookup_subsystem_name’
#  109|   static void cleanup_dirents(struct dirents *ents)
#  110|   {
#  111|-> 	while (ents->num > 0)
#  112|   		free(ents->ents[--ents->num]);
#  113|   	free(ents->ents);

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

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

Error: CPPCHECK_WARNING (CWE-758): [#def101]
libnvme-1.15/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): [#def102]
libnvme-1.15/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): [#def103]
libnvme-1.15/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): [#def104]
libnvme-1.15/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): [#def105]
libnvme-1.15/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): [#def106]
libnvme-1.15/test/ioctl/ana.c:89:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:87:36: acquire_memory: allocated here
libnvme-1.15/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): [#def107]
libnvme-1.15/test/ioctl/ana.c:128:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:126:36: acquire_memory: allocated here
libnvme-1.15/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): [#def108]
libnvme-1.15/test/ioctl/ana.c:170:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:168:36: acquire_memory: allocated here
libnvme-1.15/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): [#def109]
libnvme-1.15/test/ioctl/ana.c:217:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:215:36: acquire_memory: allocated here
libnvme-1.15/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): [#def110]
libnvme-1.15/test/ioctl/ana.c:307:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:305:36: acquire_memory: allocated here
libnvme-1.15/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): [#def111]
libnvme-1.15/test/ioctl/ana.c:378:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:376:36: acquire_memory: allocated here
libnvme-1.15/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): [#def112]
libnvme-1.15/test/ioctl/ana.c:452:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:450:36: acquire_memory: allocated here
libnvme-1.15/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): [#def113]
libnvme-1.15/test/ioctl/ana.c:552:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:550:36: acquire_memory: allocated here
libnvme-1.15/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): [#def114]
libnvme-1.15/test/ioctl/ana.c:602:9: warning[-Wanalyzer-malloc-leak]: leak of ‘log’
libnvme-1.15/test/ioctl/ana.c:600:36: acquire_memory: allocated here
libnvme-1.15/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): [#def115]
libnvme-1.15/test/ioctl/identify.c:97:9: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnvme-1.15/test/ioctl/identify.c:95:14: acquire_memory: allocated here
libnvme-1.15/test/ioctl/identify.c:96:9: branch_true: following ‘true’ branch (when ‘id’ is non-NULL)...
libnvme-1.15/test/ioctl/identify.c:97:9: branch_true: ...to here
libnvme-1.15/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): [#def116]
libnvme-1.15/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: CPPCHECK_WARNING (CWE-562): [#def117]
libnvme-1.15/test/mi-mctp.c:545: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  543|   
#  544|   	peer->tx_fn = tx_mpr;
#  545|-> 	peer->tx_data = &tx_info;
#  546|   
#  547|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def118]
libnvme-1.15/test/mi-mctp.c:563: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  561|   
#  562|   	peer->tx_fn = tx_mpr;
#  563|-> 	peer->tx_data = &tx_info;
#  564|   
#  565|   	ctrl = nvme_mi_init_ctrl(ep, 1);

Error: CPPCHECK_WARNING (CWE-562): [#def119]
libnvme-1.15/test/mi-mctp.c:588: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  586|   
#  587|   	peer->tx_fn = tx_mpr;
#  588|-> 	peer->tx_data = &tx_info;
#  589|   
#  590|   	ctrl = nvme_mi_init_ctrl(ep, 1);

Error: CPPCHECK_WARNING (CWE-562): [#def120]
libnvme-1.15/test/mi-mctp.c:677: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  675|   
#  676|   	peer->tx_fn = tx_fn_mpr_poll;
#  677|-> 	peer->tx_data = &tx_info;
#  678|   
#  679|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def121]
libnvme-1.15/test/mi-mctp.c:680: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  678|   
#  679|   	peer->poll_fn = poll_fn_mpr_poll;
#  680|-> 	peer->poll_data = &poll_info;
#  681|   
#  682|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def122]
libnvme-1.15/test/mi-mctp.c:706: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  704|   
#  705|   	peer->tx_fn = tx_fn_mpr_poll;
#  706|-> 	peer->tx_data = &tx_info;
#  707|   
#  708|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def123]
libnvme-1.15/test/mi-mctp.c:709: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  707|   
#  708|   	peer->poll_fn = poll_fn_mpr_poll;
#  709|-> 	peer->poll_data = &poll_info;
#  710|   
#  711|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def124]
libnvme-1.15/test/mi-mctp.c:735: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  733|   
#  734|   	peer->tx_fn = tx_fn_mpr_poll;
#  735|-> 	peer->tx_data = &tx_info;
#  736|   
#  737|   	peer->poll_fn = poll_fn_mpr_poll;

Error: CPPCHECK_WARNING (CWE-562): [#def125]
libnvme-1.15/test/mi-mctp.c:738: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#  736|   
#  737|   	peer->poll_fn = poll_fn_mpr_poll;
#  738|-> 	peer->poll_data = &poll_info;
#  739|   
#  740|   	rc = nvme_mi_mi_read_mi_data_subsys(ep, &ss_info);

Error: CPPCHECK_WARNING (CWE-562): [#def126]
libnvme-1.15/test/mi-mctp.c:1158: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1156|   
# 1157|   	config.aem_handler = aem_handler;
# 1158|-> 	peer->tx_data = (void *) &fn_data;
# 1159|   	peer->tx_fn = aem_rcv_enable_fn;
# 1160|   

Error: CPPCHECK_WARNING (CWE-562): [#def127]
libnvme-1.15/test/mi-mctp.c:1261: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1259|   
# 1260|   	test_peer.tx_fn = aem_rcv_enable_fn;
# 1261|-> 	peer->tx_data = (void *) &fn_data;
# 1262|   	fn_data.ep_enabled_map.enabled[8] = true;
# 1263|   	fn_data.ep_enabled_map.enabled[20] = true;

Error: CPPCHECK_WARNING (CWE-562): [#def128]
libnvme-1.15/test/mi-mctp.c:1279: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1277|   
# 1278|   	test_peer.tx_fn = aem_rcv_enable_fn;
# 1279|-> 	peer->tx_data = (void *) &fn_data;
# 1280|   
# 1281|   	aem_test_aem_disable_helper(ep, &fn_data);

Error: CPPCHECK_WARNING (CWE-562): [#def129]
libnvme-1.15/test/mi-mctp.c:1297: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1295|   	config.aemd = 1;
# 1296|   	config.aerd = 2;
# 1297|-> 	peer->tx_data = (void *) &fn_data;
# 1298|   	config.aem_handler = aem_handler;
# 1299|   

Error: CPPCHECK_WARNING (CWE-562): [#def130]
libnvme-1.15/test/mi-mctp.c:1343: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1341|   	config.aemd = 1;
# 1342|   	config.aerd = 2;
# 1343|-> 	peer->tx_data = (void *) &fn_data;
# 1344|   	config.aem_handler = aem_handler;
# 1345|   

Error: CPPCHECK_WARNING (CWE-457): [#def131]
libnvme-1.15/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): [#def132]
libnvme-1.15/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): [#def133]
libnvme-1.15/test/mock-ifaddrs.c:38:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘storage’
libnvme-1.15/test/mock-ifaddrs.c:107:45: acquire_memory: this call could return NULL
libnvme-1.15/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): [#def134]
libnvme-1.15/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.15/test/mock-ifaddrs.c:107:45: acquire_memory: allocated here
libnvme-1.15/test/mock-ifaddrs.c:110:9: call_function: inlined call to ‘init_entry’ from ‘getifaddrs’
libnvme-1.15/test/mock-ifaddrs.c:111:9: call_function: calling ‘init_entry’ from ‘getifaddrs’
libnvme-1.15/test/mock-ifaddrs.c:111:9: return_function: returning to ‘getifaddrs’ from ‘init_entry’
libnvme-1.15/test/mock-ifaddrs.c:115:9: call_function: calling ‘init_entry’ from ‘getifaddrs’
libnvme-1.15/test/mock-ifaddrs.c:115:9: return_function: returning to ‘getifaddrs’ from ‘init_entry’
libnvme-1.15/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): [#def135]
libnvme-1.15/test/zns.c:32:13: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
#   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): [#def136]
libnvme-1.15/test/zns.c:32:53: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
#   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): [#def137]
libnvme-1.15/test/zns.c:41:13: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
#   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): [#def138]
libnvme-1.15/test/zns.c:49:13: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
#   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): [#def139]
libnvme-1.15/test/zns.c:49:54: warning[-Wanalyzer-malloc-leak]: leak of ‘zr’
libnvme-1.15/test/zns.c:63:5: enter_function: entry to ‘main’
libnvme-1.15/test/zns.c:72:12: branch_false: following ‘false’ branch...
libnvme-1.15/test/zns.c:75:9: branch_false: ...to here
libnvme-1.15/test/zns.c:75:9: branch_true: following ‘true’ branch (when ‘h’ is non-NULL)...
libnvme-1.15/test/zns.c:76:17: branch_true: ...to here
libnvme-1.15/test/zns.c:76:17: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libnvme-1.15/test/zns.c:77:25: branch_true: ...to here
libnvme-1.15/test/zns.c:77:25: branch_true: following ‘true’ branch (when ‘c’ is non-NULL)...
libnvme-1.15/test/zns.c:78:33: branch_true: ...to here
libnvme-1.15/test/zns.c:78:33: branch_true: following ‘true’ branch (when ‘n’ is non-NULL)...
libnvme-1.15/test/zns.c:79:45: branch_true: ...to here
libnvme-1.15/test/zns.c:79:44: branch_true: following ‘true’ branch...
libnvme-1.15/test/zns.c:80:49: branch_true: ...to here
libnvme-1.15/test/zns.c:80:49: call_function: calling ‘show_zns_properties’ from ‘main’
#   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.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-104.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibnvme-1.15-4.fc44
store-results-to/tmp/tmp2d0yl7so/libnvme-1.15-4.fc44.tar.xz
time-created2025-10-28 19:13:22
time-finished2025-10-28 19:16:26
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmp2d0yl7so/libnvme-1.15-4.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp2d0yl7so/libnvme-1.15-4.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9