pacman-6.1.0-2.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def2]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c: scope_hint: In function ‘commit_single_pkg’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:518:19: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:42: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:432:9: note: in expansion of macro ‘ASSERT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:39: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:461:9: note: in expansion of macro ‘EVENT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:508:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:508:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:22: included_from: Included from here.
#  516|   				handle->root, strerror(errno));
#  517|   		_alpm_archive_read_free(archive);
#  518|-> 		if(cwdfd >= 0) {
#  519|   			close(cwdfd);
#  520|   		}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:568:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:432:9: note: in expansion of macro ‘ASSERT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:461:9: note: in expansion of macro ‘EVENT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:508:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:508:9: note: in expansion of macro ‘OPEN’
#  566|   
#  567|   	/* restore the old cwd if we have it */
#  568|-> 	if(cwdfd >= 0) {
#  569|   		if(fchdir(cwdfd) != 0) {
#  570|   			_alpm_log(handle, ALPM_LOG_ERROR,

Error: CLANG_WARNING: [#def4]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:623:20: warning[core.NullDereference]: Access to field 'version' results in a dereference of a null pointer (loaded from variable 'oldpkg')
#  621|   		case ALPM_PACKAGE_DOWNGRADE:
#  622|   			alpm_logaction(handle, ALPM_CALLER_PREFIX, "downgraded %s (%s -> %s)\n",
#  623|-> 					newpkg->name, oldpkg->version, newpkg->version);
#  624|   			break;
#  625|   		case ALPM_PACKAGE_REINSTALL:

Error: CLANG_WARNING: [#def5]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/add.c:631:20: warning[core.NullDereference]: Access to field 'version' results in a dereference of a null pointer (loaded from variable 'oldpkg')
#  629|   		case ALPM_PACKAGE_UPGRADE:
#  630|   			alpm_logaction(handle, ALPM_CALLER_PREFIX, "upgraded %s (%s -> %s)\n",
#  631|-> 					newpkg->name, oldpkg->version, newpkg->version);
#  632|   			break;
#  633|   		default:

Error: CPPCHECK_WARNING: [#def6]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/alpm_list.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def7]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/base64.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def8]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-457): [#def9]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c: scope_hint: In function ‘_cache_changelog_open’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:214:19: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:40: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
/usr/include/features.h:511: included_from: Included from here.
/usr/include/unistd.h:25: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:21: included_from: Included from here.
/usr/include/stdio.h:276:14: note: argument 1 of ‘fopen’ must be a pointer to a null-terminated string
#  212|   	alpm_db_t *db = alpm_pkg_get_db(pkg);
#  213|   	char *clfile = _alpm_local_db_pkgpath(db, pkg, "changelog");
#  214|-> 	FILE *f = fopen(clfile, "r");
#  215|   	free(clfile);
#  216|   	return f;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c: scope_hint: In function ‘_cache_mtree_open’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:258:12: warning[-Wanalyzer-null-argument]: use of NULL ‘_alpm_local_db_pkgpath(alpm_pkg_get_db(pkg), pkg, "mtree")’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
/usr/include/unistd.h:287:12: note: argument 1 of ‘access’ must be non-null
#  256|   	char *mtfile = _alpm_local_db_pkgpath(db, pkg, "mtree");
#  257|   
#  258|-> 	if(access(mtfile, F_OK) != 0) {
#  259|   		/* there is no mtree file for this package */
#  260|   		goto error;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def11]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c: scope_hint: In function ‘local_db_read’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:916:20: warning[-Wanalyzer-null-argument]: use of NULL ‘_alpm_local_db_pkgpath(db,  info, "install")’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
/usr/include/unistd.h:287:12: note: argument 1 of ‘access’ must be non-null
#  914|   	if(inforeq & INFRQ_SCRIPTLET && !(info->infolevel & INFRQ_SCRIPTLET)) {
#  915|   		char *path = _alpm_local_db_pkgpath(db, info, "install");
#  916|-> 		if(access(path, F_OK) == 0) {
#  917|   			info->scriptlet = 1;
#  918|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def12]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c: scope_hint: In function ‘_alpm_local_db_prepare’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:946:22: warning[-Wanalyzer-null-argument]: use of NULL ‘_alpm_local_db_pkgpath(db,  info, 0)’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:679:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_local.c:27: included_from: Included from here.
/usr/include/sys/stat.h:389:12: note: argument 1 of ‘mkdir’ must be non-null
#  944|   	pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
#  945|   
#  946|-> 	if((retval = mkdir(pkgpath, 0755)) != 0) {
#  947|   		_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"),
#  948|   				pkgpath, strerror(errno));

Error: CPPCHECK_WARNING: [#def13]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c: scope_hint: In function ‘alpm_pkg_load’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:747:40: warning[-Wanalyzer-malloc-leak]: leak of ‘sig’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:732:9: note: in expansion of macro ‘CHECK_HANDLE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:732:9: note: in expansion of macro ‘CHECK_HANDLE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:733:9: note: in expansion of macro ‘ASSERT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.h:45: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:745:41: note: in expansion of macro ‘_’
#  745|   					_("failed to read signature file: %s\n"), sigpath);
#  746|   				free(sigpath);
#  747|-> 				return -1;
#  748|   			}
#  749|   

Error: CPPCHECK_WARNING: [#def15]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def16]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:498:15: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  496|   		const char *filename)
#  497|   {
#  498|-> 	size_t len = strlen(filename);
#  499|   
#  500|   	if(filename[0] == '.') {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def17]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c: scope_hint: In function ‘_alpm_validate_filename’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:498:22: warning[-Wanalyzer-null-argument]: use of NULL ‘filename’ where non-null expected
/usr/include/locale.h:28: included_from: Included from here.
/usr/include/libintl.h:103: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.h:45: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:33: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:527:9: note: in expansion of macro ‘READ_NEXT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:605:33: note: in expansion of macro ‘READ_AND_STORE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:527:9: note: in expansion of macro ‘READ_NEXT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:605:33: note: in expansion of macro ‘READ_AND_STORE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:528:9: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:605:33: note: in expansion of macro ‘READ_AND_STORE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:528:9: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_sync.c:605:33: note: in expansion of macro ‘READ_AND_STORE’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  496|   		const char *filename)
#  497|   {
#  498|-> 	size_t len = strlen(filename);
#  499|   
#  500|   	if(filename[0] == '.') {

Error: CPPCHECK_WARNING: [#def18]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/conflict.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def19]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/db.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-476): [#def20]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/db.c:181: warning[nullPointer]: Possible null pointer dereference: newurl
#  179|   	STRDUP(newurl, url, return NULL);
#  180|   	/* strip the trailing slash if one exists */
#  181|-> 	if(newurl[len - 1] == '/') {
#  182|   		newurl[len - 1] = '\0';
#  183|   	}

Error: CPPCHECK_WARNING: [#def21]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/deps.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def22]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/diskspace.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def23]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/dload.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def24]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/dload.c:178:19: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  176|   static const char *get_filename(const char *url)
#  177|   {
#  178|-> 	char *filename = strrchr(url, '/');
#  179|   	if(filename != NULL) {
#  180|   		return filename + 1;

Error: CLANG_WARNING: [#def25]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/dload.c:576:5: warning[deadcode.DeadStores]: Value stored to 'curlerr' is never read
#  574|   			/* handle the interrupt accordingly */
#  575|   			if(dload_interrupted == ABORT_OVER_MAXFILESIZE) {
#  576|-> 				curlerr = CURLE_FILESIZE_EXCEEDED;
#  577|   				payload->unlink_on_fail = 1;
#  578|   				handle->pm_errno = ALPM_ERR_LIBCURL;

Error: CLANG_WARNING: [#def26]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/dload.c:710:3: warning[unix.Malloc]: Potential leak of memory pointed to by 'sig'
#  708|   
#  709|   		curl_add_payload(handle, curlm, sig, localpath);
#  710|-> 		(*active_downloads_num)++;
#  711|   	}
#  712|   

Error: CLANG_WARNING: [#def27]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/dload.c:1045:30: warning[core.NullDereference]: Access to field 'data' results in a dereference of a null pointer (loaded from variable 's')
# 1043|   					/* Download signature if requested */
# 1044|   					char *sig_fileurl;
# 1045|-> 					size_t sig_len = strlen(s->data) + strlen(payload->filepath) + 6;
# 1046|   					int retsig = -1;
# 1047|   

Error: CPPCHECK_WARNING (CWE-457): [#def28]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/filelist.c:132: warning[uninitvar]: Uninitialized variables: &key.size, &key.mode
#  130|   	key.name = (char *)path;
#  131|   
#  132|-> 	return bsearch(&key, filelist->files, filelist->count,
#  133|   			sizeof(alpm_file_t), _alpm_files_cmp);
#  134|   }

Error: CPPCHECK_WARNING: [#def29]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/handle.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def30]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def31]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:497:33: warning[unix.Malloc]: Use of memory after it is freed
#  495|   	while(i) {
#  496|   		alpm_list_t *next = i->next;
#  497|-> 		while(next && strcmp(i->data, next->data) == 0) {
#  498|   			list = alpm_list_remove_item(list, next);
#  499|   			free(next);

Error: CPPCHECK_WARNING: [#def32]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/log.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def33]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/package.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def34]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/pkghash.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def35]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/remove.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def36]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/signing.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def37]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/sync.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def38]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/trans.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def39]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-476): [#def40]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:116: warning[nullPointer]: Possible null pointer dereference: ptr
#  114|   	oldmask = umask(0000);
#  115|   
#  116|-> 	for(ptr = str; *ptr; ptr++) {
#  117|   		/* detect mid-path condition and zero length paths */
#  118|   		if(*ptr != '/' || ptr == str || ptr[-1] == '/') {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def41]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_makepath_mode’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:116:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ptr’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:53: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:112:9: note: in expansion of macro ‘STRDUP’
#  114|   	oldmask = umask(0000);
#  115|   
#  116|-> 	for(ptr = str; *ptr; ptr++) {
#  117|   		/* detect mid-path condition and zero length paths */
#  118|   		if(*ptr != '/' || ptr == str || ptr[-1] == '/') {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def42]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_copyfile’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:191:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:158:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:160:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:160:9: note: in expansion of macro ‘OPEN’
#  189|   cleanup:
#  190|   	free(buf);
#  191|-> 	if(in >= 0) {
#  192|   		close(in);
#  193|   	}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def43]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_open_archive’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:280:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_open_archive’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:251:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:251:9: note: in expansion of macro ‘OPEN’
#  278|   	_alpm_archive_read_free(*archive);
#  279|   	*archive = NULL;
#  280|-> 	if(fd >= 0) {
#  281|   		close(fd);
#  282|   	}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def44]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_unpack’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:407:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_unpack’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:333:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:333:9: note: in expansion of macro ‘OPEN’
#  405|   	_alpm_archive_read_free(archive);
#  406|   	close(fd);
#  407|-> 	if(cwdfd >= 0) {
#  408|   		if(fchdir(cwdfd) != 0) {
#  409|   			_alpm_log(handle, ALPM_LOG_ERROR,

Error: CLANG_WARNING: [#def45]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:477:19: warning[core.CallAndMessage]: Called function pointer is null (null dereference)
#  475|   	if(*buf_size == 0) {
#  476|   		/* empty buffer, ask the callback for more */
#  477|-> 		if((*buf_size = out_cb(buf, buf_limit, cb_ctx)) == 0) {
#  478|   			/* no more to write, close the pipe */
#  479|   			return -1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def46]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_chroot_write_to_child’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:477:33: warning[-Wanalyzer-jump-through-null]: jump through null pointer
#  475|   	if(*buf_size == 0) {
#  476|   		/* empty buffer, ask the callback for more */
#  477|-> 		if((*buf_size = out_cb(buf, buf_limit, cb_ctx)) == 0) {
#  478|   			/* no more to write, close the pipe */
#  479|   			return -1;

Error: GCC_ANALYZER_WARNING: [#def47]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘_alpm_run_chroot’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:646:23: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
#  644|   		close(1);
#  645|   		close(2);
#  646|-> 		while(dup2(child2parent_pipefd[HEAD], 1) == -1 && errno == EINTR);
#  647|   		while(dup2(child2parent_pipefd[HEAD], 2) == -1 && errno == EINTR);
#  648|   		while(dup2(parent2child_pipefd[TAIL], 0) == -1 && errno == EINTR);

Error: GCC_ANALYZER_WARNING: [#def48]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:647:23: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘2’
#  645|   		close(2);
#  646|   		while(dup2(child2parent_pipefd[HEAD], 1) == -1 && errno == EINTR);
#  647|-> 		while(dup2(child2parent_pipefd[HEAD], 2) == -1 && errno == EINTR);
#  648|   		while(dup2(parent2child_pipefd[TAIL], 0) == -1 && errno == EINTR);
#  649|   		close(parent2child_pipefd[TAIL]);

Error: GCC_ANALYZER_WARNING: [#def49]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:648:23: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘0’
#  646|   		while(dup2(child2parent_pipefd[HEAD], 1) == -1 && errno == EINTR);
#  647|   		while(dup2(child2parent_pipefd[HEAD], 2) == -1 && errno == EINTR);
#  648|-> 		while(dup2(parent2child_pipefd[TAIL], 0) == -1 && errno == EINTR);
#  649|   		close(parent2child_pipefd[TAIL]);
#  650|   		close(parent2child_pipefd[HEAD]);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def50]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:653:19: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:603:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:603:9: note: in expansion of macro ‘OPEN’
#  651|   		close(child2parent_pipefd[TAIL]);
#  652|   		close(child2parent_pipefd[HEAD]);
#  653|-> 		if(cwdfd >= 0) {
#  654|   			close(cwdfd);
#  655|   		}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def51]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:786:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:603:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:603:9: note: in expansion of macro ‘OPEN’
#  784|   
#  785|   cleanup:
#  786|-> 	if(cwdfd >= 0) {
#  787|   		if(fchdir(cwdfd) != 0) {
#  788|   			_alpm_log(handle, ALPM_LOG_ERROR,

Error: GCC_ANALYZER_WARNING (CWE-775): [#def52]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘md5_file’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:953:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:950:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:952:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:952:9: note: in expansion of macro ‘OPEN’
#  951|   
#  952|   	OPEN(fd, path, O_RDONLY | O_CLOEXEC);
#  953|-> 	if(fd < 0) {
#  954|   		free(buf);
#  955|   		return 1;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def53]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c: scope_hint: In function ‘sha256_file’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:1012:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘<unknown>’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:1009:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:1011:9: note: in expansion of macro ‘OPEN’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.c:1011:9: note: in expansion of macro ‘OPEN’
# 1010|   
# 1011|   	OPEN(fd, path, O_RDONLY | O_CLOEXEC);
# 1012|-> 	if(fd < 0) {
# 1013|   		free(buf);
# 1014|   		return 1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def54]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.h:58:68: warning[-Wanalyzer-malloc-leak]: leak of ‘*current_file.name’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:427:17: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:732:9: note: in expansion of macro ‘CHECK_HANDLE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:732:9: note: in expansion of macro ‘CHECK_HANDLE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:733:9: note: in expansion of macro ‘ASSERT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:587:9: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:587:9: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c: scope_hint: In function ‘add_entry_to_files_list’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:427:17: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:427:17: note: in expansion of macro ‘STRDUP’
#   56|   #define REALLOC(p, s, action) do { void* np = realloc(p, s); if(np == NULL) { _alpm_alloc_fail(s); action; } else { p = np; } } while(0)
#   57|   /* This strdup macro is NULL safe- copying NULL will yield NULL */
#   58|-> #define STRDUP(r, s, action) do { if(s != NULL) { r = strdup(s); if(r == NULL) { _alpm_alloc_fail(strlen(s)); action; } } else { r = NULL; } } while(0)
#   59|   #define STRNDUP(r, s, l, action) do { if(s != NULL) { r = strndup(s, l); if(r == NULL) { _alpm_alloc_fail(l); action; } } else { r = NULL; } } while(0)
#   60|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def55]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:30: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c: scope_hint: In function ‘_alpm_hook_run’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.h:58:68: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(&*<unknown>.d_name)’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:617:25: note: in expansion of macro ‘STRDUP’
/usr/include/archive.h:39: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/alpm.h:42: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/handle.h:28: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:25: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:605:25: note: in expansion of macro ‘CALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:605:25: note: in expansion of macro ‘CALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.h:58:51: note: in definition of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:617:25: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/hook.c:617:25: note: in expansion of macro ‘STRDUP’
#   56|   #define REALLOC(p, s, action) do { void* np = realloc(p, s); if(np == NULL) { _alpm_alloc_fail(s); action; } else { p = np; } } while(0)
#   57|   /* This strdup macro is NULL safe- copying NULL will yield NULL */
#   58|-> #define STRDUP(r, s, action) do { if(s != NULL) { r = strdup(s); if(r == NULL) { _alpm_alloc_fail(strlen(s)); action; } } else { r = NULL; } } while(0)
#   59|   #define STRNDUP(r, s, l, action) do { if(s != NULL) { r = strndup(s, l); if(r == NULL) { _alpm_alloc_fail(l); action; } } else { r = NULL; } } while(0)
#   60|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:37: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c: scope_hint: In function ‘add_entry_to_files_list’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/util.h:58:68: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(path)’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:427:17: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:732:9: note: in expansion of macro ‘CHECK_HANDLE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:732:9: note: in expansion of macro ‘CHECK_HANDLE’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:733:9: note: in expansion of macro ‘ASSERT’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:713:9: note: in expansion of macro ‘MALLOC’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:587:9: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:587:9: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:427:17: note: in expansion of macro ‘STRDUP’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/be_package.c:427:17: note: in expansion of macro ‘STRDUP’
#   56|   #define REALLOC(p, s, action) do { void* np = realloc(p, s); if(np == NULL) { _alpm_alloc_fail(s); action; } else { p = np; } } while(0)
#   57|   /* This strdup macro is NULL safe- copying NULL will yield NULL */
#   58|-> #define STRDUP(r, s, action) do { if(s != NULL) { r = strdup(s); if(r == NULL) { _alpm_alloc_fail(strlen(s)); action; } } else { r = NULL; } } while(0)
#   59|   #define STRNDUP(r, s, l, action) do { if(s != NULL) { r = strndup(s, l); if(r == NULL) { _alpm_alloc_fail(l); action; } } else { r = NULL; } } while(0)
#   60|   

Error: CPPCHECK_WARNING: [#def57]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def58]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c: scope_hint: In function ‘parseEVR’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c:49:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘s’
#   47|   	s = evr;
#   48|   	/* s points to epoch terminator */
#   49|-> 	while (*s && isdigit(*s)) s++;
#   50|   	/* se points to version terminator */
#   51|   	se = strrchr(s, '-');

Error: GCC_ANALYZER_WARNING (CWE-476): [#def59]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c: scope_hint: In function ‘rpmvercmp.part.0’
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c:103:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ptr1’
#  101|   
#  102|   	/* loop through each version segment of str1 and str2 and compare them */
#  103|-> 	while (*one && *two) {
#  104|   		while (*one && !isalnum((int)*one)) one++;
#  105|   		while (*two && !isalnum((int)*two)) two++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def60]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c:103:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ptr2’
#  101|   
#  102|   	/* loop through each version segment of str1 and str2 and compare them */
#  103|-> 	while (*one && *two) {
#  104|   		while (*one && !isalnum((int)*one)) one++;
#  105|   		while (*two && !isalnum((int)*two)) two++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def61]
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/version.c:195:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘two’
#  193|   	/* compared identically but the segment separating characters were */
#  194|   	/* different */
#  195|-> 	if ((!*one) && (!*two)) {
#  196|   		ret = 0;
#  197|   		goto cleanup;

Error: CPPCHECK_WARNING: [#def62]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def63]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c: scope_hint: In function ‘dload_init_event’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c:713:23: warning[-Wanalyzer-malloc-leak]: leak of ‘clean_filename(filename)’
#  711|   static int dload_progressbar_enabled(void)
#  712|   {
#  713|-> 	return !config->noprogressbar && (getcols() != 0);
#  714|   }
#  715|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def64]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c: scope_hint: In function ‘clean_filename’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c:767:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fname’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strstr’ must be non-null
#  765|   	char *fname = strdup(filename);
#  766|   	/* strip package or DB extension for cleaner look */
#  767|-> 	if((p = strstr(fname, ".pkg")) || (p = strstr(fname, ".db")) || (p = strstr(fname, ".files"))) {
#  768|   		fname[p - fname] = '\0';
#  769|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def65]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c: scope_hint: In function ‘draw_pacman_progress_bar’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c:808:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘name’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/callback.c:21: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null
#  806|   		size_t needed = strlen(fname) + (digits * 2) + 4 + 1;
#  807|   		char *name = malloc(needed);
#  808|-> 		sprintf(name, "%s (%*zu/%*zu)", fname, digits, bar->downloaded, digits, bar->howmany);
#  809|   		free(fname);
#  810|   		fname = name;

Error: CPPCHECK_WARNING: [#def66]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/check.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def67]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def68]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:247:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  245|   		sigprocmask(SIG_SETMASK, &oldblock, NULL);
#  246|   
#  247|-> 		execvp(file, argv);
#  248|   
#  249|   		/* execvp failed, pass the error back to the parent */

Error: CLANG_WARNING: [#def69]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1236:5: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 1234|   	}
# 1235|   
# 1236|-> 	if(strcmp(key, "Include") == 0) {
# 1237|   		return process_include(value, data, file, linenum);
# 1238|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def70]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c: scope_hint: In function ‘setdefaults’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1314:35: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘rootdir’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 1312|   	if(c->rootdir) {
# 1313|   		char* rootdir = strdup(c->rootdir);
# 1314|-> 		int rootdir_len = strlen(rootdir);
# 1315|   		/* This removes trailing slashes from the root directory */
# 1316|   		if(rootdir[rootdir_len-1] == '/'){

Error: GCC_ANALYZER_WARNING (CWE-401): [#def71]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1326:40: warning[-Wanalyzer-malloc-leak]: leak of ‘ppath’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1310:34: note: in definition of macro ‘SETDEFAULT’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1328:25: note: in expansion of macro ‘SETDEFAULT’
# 1324|   			if(ppath == NULL) {
# 1325|   				free(rootdir);
# 1326|-> 				return -1;
# 1327|   			}
# 1328|   			SETDEFAULT(c->dbpath, ppath);

Error: CPPCHECK_WARNING (CWE-401): [#def72]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1328: error[memleak]: Memory leak: rootdir
# 1326|   				return -1;
# 1327|   			}
# 1328|-> 			SETDEFAULT(c->dbpath, ppath);
# 1329|   		}
# 1330|   		if(!c->logfile) {

Error: CPPCHECK_WARNING (CWE-401): [#def73]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1329: error[memleak]: Memory leak: ppath
# 1327|   			}
# 1328|   			SETDEFAULT(c->dbpath, ppath);
# 1329|-> 		}
# 1330|   		if(!c->logfile) {
# 1331|   			char* ppath;

Error: CPPCHECK_WARNING (CWE-401): [#def74]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1338: error[memleak]: Memory leak: rootdir
# 1336|   				return -1;
# 1337|   			}
# 1338|-> 			SETDEFAULT(c->logfile, ppath);
# 1339|   		}
# 1340|   		free(rootdir);

Error: CPPCHECK_WARNING (CWE-401): [#def75]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/conf.c:1339: error[memleak]: Memory leak: ppath
# 1337|   			}
# 1338|   			SETDEFAULT(c->logfile, ppath);
# 1339|-> 		}
# 1340|   		free(rootdir);
# 1341|   	} else {

Error: CPPCHECK_WARNING: [#def76]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/database.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def77]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/database.c: scope_hint: In function ‘check_db_local_filelist_conflicts’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/database.c:214:48: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘all_files’
#  212|   
#  213|   			/* we can finally add it to the list */
#  214|-> 			all_files[offset].file = file;
#  215|   			all_files[offset].pkg = pkg;
#  216|   			offset++;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def78]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/database.c:221:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘all_files’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/alpm_list.h:25: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/lib/libalpm/alpm.h:45: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/database.c:26: included_from: Included from here.
/usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null
#  219|   
#  220|   	/* now sort the list so we can find duplicates */
#  221|-> 	qsort(all_files, offset, sizeof(struct fileitem), fileitem_cmp);
#  222|   
#  223|   	/* do a 'uniq' style check on the list */

Error: CPPCHECK_WARNING: [#def79]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/files.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def80]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/files.c: scope_hint: In function ‘files_search’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/files.c:136:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ftarg’
#  134|   
#  135|   		struct filetarget *ftarg = malloc(sizeof(struct filetarget));
#  136|-> 		ftarg->targ = targ;
#  137|   		ftarg->exact_file = exact_file;
#  138|   		ftarg->reg = reg;

Error: CPPCHECK_WARNING: [#def81]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-401): [#def82]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c:175: error[memleakOnRealloc]: Common realloc mistake: 'depstring' nulled but not freed upon failure
#  173|   			if(alpm_find_satisfier(alpm_db_get_pkgcache(localdb), depstring)) {
#  174|   				const char *installed = _(" [installed]");
#  175|-> 				depstring = realloc(depstring, strlen(depstring) + strlen(installed) + 1);
#  176|   				strcpy(depstring + strlen(depstring), installed);
#  177|   			}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def83]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c: scope_hint: In function ‘optdeplist_display’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c:176:52: warning[-Wanalyzer-null-argument]: use of NULL ‘depstring’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.h:35: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c:35: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c:174:57: note: in expansion of macro ‘_’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  174|   				const char *installed = _(" [installed]");
#  175|   				depstring = realloc(depstring, strlen(depstring) + strlen(installed) + 1);
#  176|-> 				strcpy(depstring + strlen(depstring), installed);
#  177|   			}
#  178|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def84]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c: scope_hint: In function ‘dump_pkg_backups’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c:431:68: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/package.c:389:41: note: in expansion of macro ‘_’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  429|   		}
#  430|   		value = get_backup_file_status(root, backup);
#  431|-> 		needed = strlen(root) + strlen(backup->name) + 1 + strlen(value) + 1;
#  432|   		line = malloc(needed);
#  433|   		if(!line) {

Error: CPPCHECK_WARNING: [#def85]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/pacman-conf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def86]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/pacman.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def87]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/query.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def88]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/remove.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def89]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-688): [#def90]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c: scope_hint: In function ‘sync_cleandb’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c:121:34: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘dbname’ where non-null expected
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.h:35: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c:36: included_from: Included from here.
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c:146:16: note: in expansion of macro ‘_’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c:23: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  119|   		for(i = syncdbs; i && !found; i = alpm_list_next(i)) {
#  120|   			alpm_db_t *db = i->data;
#  121|-> 			found = !strcmp(dbname, alpm_db_get_name(db));
#  122|   		}
#  123|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def91]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c: scope_hint: In function ‘sync_info’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c:411:34: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘name’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
#  409|   			int foundpkg = 0, founddb = 0;
#  410|   
#  411|-> 			pkgstr = strchr(name, '/');
#  412|   			if(pkgstr) {
#  413|   				repo = name;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def92]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c: scope_hint: In function ‘process_target’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/sync.c:654:26: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘targstring’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
#  652|   	/* process targets */
#  653|   	char *targstring = strdup(target);
#  654|-> 	char *targname = strchr(targstring, '/');
#  655|   	int ret = 0;
#  656|   	alpm_list_t *dblist;

Error: CPPCHECK_WARNING: [#def93]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: COMPILER_WARNING (CWE-252): [#def94]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c: scope_hint: In function ‘concat_list’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:431:25: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  431 |                         asprintf(&output, "%s %s", tmp, str);
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  429|   
#  430|   		if(tmp) {
#  431|-> 			asprintf(&output, "%s %s", tmp, str);
#  432|   			free(tmp);
#  433|   		} else {

Error: COMPILER_WARNING (CWE-252): [#def95]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:434:25: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  434 |                         asprintf(&output, "%s", str);
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  432|   			free(tmp);
#  433|   		} else {
#  434|-> 			asprintf(&output, "%s", str);
#  435|   		}
#  436|   		tmp = output;

Error: COMPILER_WARNING (CWE-252): [#def96]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:444:17: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  444 |                 asprintf(&output, "%s", "");
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#  442|   
#  443|   	if(!output) {
#  444|-> 		asprintf(&output, "%s", "");
#  445|   	}
#  446|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def97]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c: scope_hint: In function ‘string_length.part.0’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:477:40: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘replaced’
#  475|   			}
#  476|   
#  477|-> 			replaced[iter] = *s;
#  478|   			iter++;
#  479|   		}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def98]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:480:32: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘replaced’
#  478|   			iter++;
#  479|   		}
#  480|-> 		replaced[iter] = '\0';
#  481|   		len = iter;
#  482|   		wcstr = calloc(len, sizeof(wchar_t));

Error: CLANG_WARNING: [#def99]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:650:15: warning[core.UndefinedBinaryOperatorResult]: The right operand of '>' is a garbage value
#  648|   			size_t str_len = cell ? cell->len : 0;
#  649|   
#  650|-> 			if(str_len > colwidths[curcol]) {
#  651|   				colwidths[curcol] = str_len;
#  652|   			}

Error: CPPCHECK_WARNING (CWE-401): [#def100]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:1351: error[memleakOnRealloc]: Common realloc mistake: 'optstring' nulled but not freed upon failure
# 1349|   	}
# 1350|   	if(status) {
# 1351|-> 		optstring = realloc(optstring, strlen(optstring) + strlen(status) + 1);
# 1352|   		strcpy(optstring + strlen(optstring), status);
# 1353|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def101]
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c: scope_hint: In function ‘make_optstring’
pacman-6.1.0-build/pacman-v6.1.0/src/pacman/util.c:1352:36: warning[-Wanalyzer-null-argument]: use of NULL ‘optstring’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 1350|   	if(status) {
# 1351|   		optstring = realloc(optstring, strlen(optstring) + strlen(status) + 1);
# 1352|-> 		strcpy(optstring + strlen(optstring), status);
# 1353|   	}
# 1354|   	return optstring;

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-126.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namepacman-6.1.0-2.fc41
store-results-to/tmp/tmp6kzq3olo/pacman-6.1.0-2.fc41.tar.xz
time-created2024-07-03 16:30:37
time-finished2024-07-03 16:32:17
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp6kzq3olo/pacman-6.1.0-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp6kzq3olo/pacman-6.1.0-2.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9