Menu

False positive: freopen

2025-10-01
2025-10-02
  • Gwyn Ciesla

    Gwyn Ciesla - 2025-10-01

    From: https://bugzilla.redhat.com/show_bug.cgi?id=2400880

    filter.c:71:7: error: Return value of allocation function 'freopen' is not
    stored. [leakReturnValNotUsed]
    if (freopen(NULL, "w+b", imf) == NULL) die( errno, LOC );

    Since freopen() returns either imf or NULL, cppcheck should accept this line of
    code. This error report is probably the result of some general logic from which
    freopen() should be exempted.

     
  • CHR

    CHR - 2025-10-02

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14171

     
  • Gwyn Ciesla

    Gwyn Ciesla - 2025-10-02

    Thank you!

     

Log in to post a comment.