public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "antonio.chirizzi at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/99042] New: file-leak is wrong Date: Tue, 09 Feb 2021 18:54:15 +0000 [thread overview] Message-ID: <bug-99042-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99042 Bug ID: 99042 Summary: file-leak is wrong Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: antonio.chirizzi at gmail dot com Target Milestone: --- Created attachment 50155 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50155&action=edit Reproducer log.c file for the bug A file leak warning is shown, but it should not. See attached log.c reproducer. Please note that I tried to strip the file to a minimum (while trying to leave all the big complex data structures), but it still shows many warnings due to undeclared functions (it's part of the git code base) The leak warning is anyway consistent with what is shown on the real log.c file in the code base. In function ‘open_next_file’: log.c:495:16: warning: leak of FILE ‘<unknown>’ [CWE-775] [-Wanalyzer-file-leak] 495 | return 0; | ^ ‘open_next_file’: events 1-3 | | 491 | if ((rev->diffopt.file = fopen(filename.buf, "w")) == NULL) | | ^ | | | | | (1) following ‘false’ branch... |...... | 494 | strbuf_release(&filename); | | ~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) ...to here | 495 | return 0; | | ~ | | | | | (3) ‘<unknown>’ leaks here | Use "gcc -fanalyzer -c log.c"
next reply other threads:[~2021-02-09 18:54 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-09 18:54 antonio.chirizzi at gmail dot com [this message] 2021-02-09 21:50 ` [Bug analyzer/99042] Another false -Wanalyzer-malloc-leak on code path involving unknown function call dmalcolm at gcc dot gnu.org 2021-02-10 8:55 ` antonio.chirizzi at gmail dot com 2021-02-10 11:24 ` dmalcolm at gcc dot gnu.org 2021-04-08 13:47 ` cvs-commit at gcc dot gnu.org 2021-04-08 13:56 ` 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-99042-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).