hostname-3.25-1.fc42

List of Findings

Error: CPPCHECK_WARNING (CWE-401): [#def1]
hostname-3.25-build/hostname/hostname.c:91: error[memleakOnRealloc]: Common realloc mistake: 'buf' nulled but not freed upon failure
#   89|   		if (buf) {
#   90|   			buf_len += buf_len;
#   91|-> 			if ((buf = realloc (buf, buf_len)) == NULL)
#   92|   				err(1, NULL);
#   93|   		} else {

Error: CPPCHECK_WARNING (CWE-401): [#def2]
hostname-3.25-build/hostname/hostname.c:126: error[memleakOnRealloc]: Common realloc mistake: 'buf' nulled but not freed upon failure
#  124|   		if (buf) {
#  125|   			buf_len += buf_len;
#  126|-> 			if ((buf = realloc (buf, buf_len)) == NULL)
#  127|   				err(1, NULL);
#  128|   		} else {

Error: CPPCHECK_WARNING (CWE-401): [#def3]
hostname-3.25-build/hostname/hostname.c:276: error[leakNoVarFunctionCall]: Allocation with localdomain, printf doesn't release it.
#  274|   			break;
#  275|   		case NIS:
#  276|-> 			printf("%s\n", localdomain());
#  277|   			break;
#  278|   		case NIS_DEF:

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
hostname-3.25-build/hostname/hostname.c: scope_hint: In function ‘read_file’
hostname-3.25-build/hostname/hostname.c:413:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "r")’
#  411|   	}
#  412|   
#  413|-> 	if (fstat(fileno(fp), &st) == -1
#  414|   	   || (buf = (char *) calloc(st.st_size + 1, sizeof(char))) == NULL)
#  415|   		err(1, NULL);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
hostname-3.25-build/hostname/hostname.c:413:12: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "r")’
#  411|   	}
#  412|   
#  413|-> 	if (fstat(fileno(fp), &st) == -1
#  414|   	   || (buf = (char *) calloc(st.st_size + 1, sizeof(char))) == NULL)
#  415|   		err(1, NULL);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
hostname-3.25-build/hostname/hostname.c:414:40: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "r")’
#  412|   
#  413|   	if (fstat(fileno(fp), &st) == -1
#  414|-> 	   || (buf = (char *) calloc(st.st_size + 1, sizeof(char))) == NULL)
#  415|   		err(1, NULL);
#  416|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
hostname-3.25-build/hostname/hostname.c:414:40: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "r")’
#  412|   
#  413|   	if (fstat(fileno(fp), &st) == -1
#  414|-> 	   || (buf = (char *) calloc(st.st_size + 1, sizeof(char))) == NULL)
#  415|   		err(1, NULL);
#  416|   

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-136.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namehostname-3.25-1.fc42
store-results-to/tmp/tmpbmdwuo_p/hostname-3.25-1.fc42.tar.xz
time-created2024-11-13 00:34:30
time-finished2024-11-13 00:35:34
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpbmdwuo_p/hostname-3.25-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpbmdwuo_p/hostname-3.25-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9