public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "urs at akk dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109120] New: False positive -Wanalyzer-malloc-leak with failed iconv_open() Date: Tue, 14 Mar 2023 05:37:33 +0000 [thread overview] Message-ID: <bug-109120-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109120 Bug ID: 109120 Summary: False positive -Wanalyzer-malloc-leak with failed iconv_open() Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: urs at akk dot org Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Build: x86_64-pc-linux-gnu Created attachment 54660 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54660&action=edit minimal test case gcc build from git @ a9835599fdb56f33da23e4514a9e21d8c2d51d71 with configure --program-suffix=-13 --enable-languages=c,lto --enable-lto --disable-multilib --enable-default-pie make -j 12 BOOT_CFLAGS='-pipe -O0 -w' bootstrap on x86_64-pc-linux-gnu (AMD Ryzen 7 PRO 6850U); Debian GNU/Linux 12 (bookworm); Kernel 6.1.0-4-amd64; GLIBC 2.36-8 gcc-13 -v -save-temps -freport-bug -g -std=c11 -O0 -fanalyzer -c iconv.c -o iconv results in iconv.c: In function ‘t’: iconv.c:11:5: warning: leak of ‘cd’ [CWE-401] [-Wanalyzer-malloc-leak] 11 | return; | ^~~~~~ ‘t’: events 1-2 | | 8 | if ((cd = iconv_open("From", "To")) != (iconv_t) (-1)) { | | ~ ^~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | (1) allocated here | | (2) following ‘false’ branch (when ‘cd == 18446744073709551615’)... | ‘t’: event 3 | |cc1: | (3): ...to here | ‘t’: event 4 | | 11 | return; | | ^~~~~~ | | | | | (4) ‘cd’ leaks here; was allocated at (1) |
next reply other threads:[~2023-03-14 5:37 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-14 5:37 urs at akk dot org [this message] 2023-03-14 15:16 ` [Bug analyzer/109120] " dmalcolm at gcc dot gnu.org 2023-03-14 16:11 ` dmalcolm at gcc dot gnu.org 2023-03-14 16:13 ` dmalcolm at gcc dot gnu.org 2023-03-14 16:16 ` dmalcolm at gcc dot gnu.org 2023-03-14 16:31 ` [Bug analyzer/109120] False positive -Wanalyzer-malloc-leak with failed iconv_open() with glibc 2.36 onwards dmalcolm at gcc dot gnu.org 2023-03-14 16:50 ` dmalcolm at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109120-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).