# podman-5.3.0~dev-1.20241014211135405666.main.1749.3fbae8e28

## List of Findings

    Error: GCC_ANALYZER_WARNING (CWE-1341): [#def1]
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c:4: included_from: Included from here.
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c: scope_hint: In function ‘cleanup_closep.part.0’
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c:51:25: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘*(void *)p’
    #   49|     int *pp = p;
    #   50|     if (*pp >= 0)
    #   51|->     TEMP_FAILURE_RETRY (close (*pp));
    #   52|   }
    #   53|

    Error: GCC_ANALYZER_WARNING (CWE-1341): [#def2]
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c:51:25: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘fd’
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c: scope_hint: In function ‘cleanup_closep.part.0’
    #   49|     int *pp = p;
    #   50|     if (*pp >= 0)
    #   51|->     TEMP_FAILURE_RETRY (close (*pp));
    #   52|   }
    #   53|

    Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c: scope_hint: In function ‘get_cmd_line_args’
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c:308:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/proc/self/cmdline", 0)’
    #  306|     char **argv;
    #  307|
    #  308|->   fd = open ("/proc/self/cmdline", O_RDONLY);
    #  309|     if (fd < 0)
    #  310|       return NULL;

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c: scope_hint: In function ‘init’
    podman-5.3.0_dev-build/podman-5.3.0-dev/pkg/rootless/rootless_linux.c:453:7: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc/self/fd")’
    #  451|
    #  452|     /* Store how many FDs were open before the Go runtime kicked in.  */
    #  453|->   d = opendir ("/proc/self/fd");
    #  454|     if (d)
    #  455|       {

    Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c: scope_hint: In function ‘parse_proc_stringlist’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:118:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(list, 0)’
    #  116|   		new_size = used + BUFSTEP;
    #  117|   		new_buf = realloc(buf, new_size);
    #  118|-> 		if (new_buf == NULL) {
    #  119|   			free(buf);
    #  120|   			fprintf(stderr, "realloc(%ld): out of memory\n", (long)(size + BUFSTEP));

    Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:125:28: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(list, 0)’
    #  123|   		buf = new_buf;
    #  124|   		size = new_size;
    #  125|-> 		memset(buf + used, '\0', size - used);
    #  126|   		n = read(fd, buf + used, size - used - 1);
    #  127|   		if (n < 0) {

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c: scope_hint: In function ‘containers_reexec’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:125:28: warning[-Wanalyzer-malloc-leak]: leak of ‘parse_proc_stringlist("/proc/self/cmdline")’
    #  123|   		buf = new_buf;
    #  124|   		size = new_size;
    #  125|-> 		memset(buf + used, '\0', size - used);
    #  126|   		n = read(fd, buf + used, size - used - 1);
    #  127|   		if (n < 0) {

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:128:25: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’
    #  126|   		n = read(fd, buf + used, size - used - 1);
    #  127|   		if (n < 0) {
    #  128|-> 			fprintf(stderr, "read(): %m\n");
    #  129|   			return NULL;
    #  130|   		}

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c: scope_hint: In function ‘parse_proc_stringlist’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:128:25: warning[-Wanalyzer-malloc-leak]: leak of ‘new_buf’
    #  126|   		n = read(fd, buf + used, size - used - 1);
    #  127|   		if (n < 0) {
    #  128|-> 			fprintf(stderr, "read(): %m\n");
    #  129|   			return NULL;
    #  130|   		}

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:154:16: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’
    #  152|   		}
    #  153|   	}
    #  154|-> 	ret[i] = NULL;
    #  155|   	return ret;
    #  156|   }

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:154:16: warning[-Wanalyzer-malloc-leak]: leak of ‘new_buf’
    #  152|   		}
    #  153|   	}
    #  154|-> 	ret[i] = NULL;
    #  155|   	return ret;
    #  156|   }

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c: scope_hint: In function ‘containers_reexec’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:291:12: warning[-Wanalyzer-malloc-leak]: leak of ‘parse_proc_stringlist("/proc/self/cmdline")’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/containers/storage/pkg/unshare/unshare.c:18: included_from: Included from here.
    #  289|   		return fd;
    #  290|
    #  291|-> 	if (fexecve(fd, argv, environ) == -1) {
    #  292|   		close(fd);
    #  293|   		fprintf(stderr, "Error during reexec(...): %m\n");

    Error: COMPILER_WARNING (CWE-1164): [#def13]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/mattn/go-sqlite3/sqlite3.go:85:1: warning[-Wunused-function]: ‘_sqlite3_exec’ defined but not used
    #   85 | _sqlite3_exec(sqlite3* db, const char* pcmd, long long* rowid, long long* changes)
    #      | ^~~~~~~~~~~~~
    #   83|
    #   84|   static int
    #   85|-> _sqlite3_exec(sqlite3* db, const char* pcmd, long long* rowid, long long* changes)
    #   86|   {
    #   87|     int rv = sqlite3_exec(db, pcmd, 0, 0, 0);

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/miekg/pkcs11/pkcs11.go: scope_hint: In function 'New'
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/miekg/pkcs11/pkcs11.go:77:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'c'
    #   75|   	CK_C_GetFunctionList list;
    #   76|   	struct ctx *c = calloc(1, sizeof(struct ctx));
    #   77|-> 	c->handle = dlopen(module, RTLD_LAZY);
    #   78|   	if (c->handle == NULL) {
    #   79|   		free(c);

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/miekg/pkcs11/pkcs11.go: scope_hint: In function ‘New’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/miekg/pkcs11/pkcs11.go:77:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘c’
    #   75|   	CK_C_GetFunctionList list;
    #   76|   	struct ctx *c = calloc(1, sizeof(struct ctx));
    #   77|-> 	c->handle = dlopen(module, RTLD_LAZY);
    #   78|   	if (c->handle == NULL) {
    #   79|   		free(c);

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/miekg/pkcs11/pkcs11.go: scope_hint: In function ‘GetAttributeValue.part.0’
    podman-5.3.0_dev-build/podman-5.3.0-dev/vendor/github.com/miekg/pkcs11/pkcs11.go:316:32: warning[-Wanalyzer-malloc-leak]: leak of ‘*((CK_ATTRIBUTE *)temp).pValue’
    #  314|   			continue;
    #  315|   		}
    #  316|-> 		temp[i].pValue = calloc(temp[i].ulValueLen, sizeof(CK_BYTE));
    #  317|   	}
    #  318|   	return c->sym->C_GetAttributeValue(session, object, temp, templen);

## Scan Properties

analyzer-version-clippy | 1.81.0
analyzer-version-cppcheck | 2.15.0
analyzer-version-gcc | 14.2.1
analyzer-version-gcc-analyzer | 14.2.1
analyzer-version-shellcheck | 0.10.0
analyzer-version-unicontrol | 0.0.2
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol
exit-code | 0
host | ip-172-16-1-135.us-west-2.compute.internal
mock-config | fedora-rawhide-x86_64
project-name | podman-5.3.0~dev-1.20241014211135405666.main.1749.3fbae8e28
store-results-to | /tmp/tmp591nad4n/podman-5.3.0~dev-1.20241014211135405666.main.1749.3fbae8e28.tar.xz
time-created | 2024-10-15 13:17:16
time-finished | 2024-10-15 13:28:31
tool | csmock
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,cppcheck,shellcheck,unicontrol' '-o' '/tmp/tmp591nad4n/podman-5.3.0~dev-1.20241014211135405666.main.1749.3fbae8e28.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '/tmp/tmp591nad4n/podman-5.3.0~dev-1.20241014211135405666.main.1749.3fbae8e28.src.rpm'
tool-version | csmock-3.7.1-1.el9