utest.h icon indicating copy to clipboard operation
utest.h copied to clipboard

error: double-'free' of '<unknown>' [CWE-415] [-Werror=analyzer-double-free]

Open yesudeep opened this issue 4 years ago • 1 comments

Error:

third_party/utest/utest.h: In function 'utest_main':
third_party/utest/utest.h:1122:5: error: double-'free' of '<unknown>' [CWE-415] [-Werror=analyzer-double-free]
 1122 |     free(UTEST_PTR_CAST(void *, utest_state.tests[index].name));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as error

Build configuration:

❯ ./configure
...
Configuration parameters:
  AR_FLAGS                       cru
  CC                             gcc
  CC vendor                      gnu
  CC version                     10.3.0
  CFLAGS
                                 -g
                                 -O2
                                 -std=c11
                                 -fanalyzer
                                 -fdiagnostics-color=always
                                 -Wall
                                 -Wextra
                                 -Werror
                                 -Wfatal-errors
                                 -Wpedantic
                                 -pedantic-errors
                                 -Werror=missing-declarations
                                 -Werror=unused
                                 -Werror=unused-result
                                 -Werror=unused-local-typedefs
                                 -Werror=write-strings
                                 -Werror=sign-conversion
                                 -Werror=narrowing
                                 -Werror=uninitialized
                                 -Wformat=2
                                 -Wformat-security
                                 -Wformat-y2k
                                 -fstack-protector-all
  CPP                            gcc -E
  CPPFLAGS
                                 -U_FORTIFY_SOURCE
                                 -D_FORTIFY_SOURCE=2
  CXX                            g++
  CXX vendor
  CXX version
  CXXFLAGS
                                 -g
                                 -O2
  LDFLAGS
  HOST
  HOSTNAME
  OSTYPE
  uname -mrs                     FreeBSD 13.0-RELEASE amd64
  host                           amd64-unknown-freebsd13.0
  enable-hardening               yes
  enable-asan                    no
  enable-tsan                    no
  enable-ubsan                   no

yesudeep avatar Nov 05 '21 00:11 yesudeep

I'm not doubting that this is right - but I cannot for the life of me work out how this is possible with the code. Is there anyway that warning can be wrong?

sheredom avatar Nov 14 '22 19:11 sheredom