Clang static analysis of libtess shows undefined values and use of memory after free
Submitted by Jonathan Liu
Assigned to mes..@..op.org
Description
Using static analyzer included in clang 3.6.2:
$ ./autogen.sh
$ ./configure
$ scan-build make
CC src/libtess/dict.lo
CC src/libtess/geom.lo
CC src/libtess/memalloc.lo
CC src/libtess/mesh.lo
CC src/libtess/normal.lo
src/libtess/normal.c:112:6: warning: Assigned value is garbage or undefined
v1 = minVert[i];
^ ~~~~~~~~~~
src/libtess/normal.c:113:6: warning: Assigned value is garbage or undefined
v2 = maxVert[i];
^ ~~~~~~~~~~
2 warnings generated.
CC src/libtess/priorityq.lo
CC src/libtess/render.lo
CC src/libtess/sweep.lo
src/libtess/sweep.c:779:11: warning: Use of memory after it is freed
if( ! regUp->dirty ) {
^~~~~~~~~~~~
src/libtess/sweep.c:803:10: warning: Use of memory after it is freed
eLo = regLo->eUp;
^~~~~~~~~~
src/libtess/sweep.c:808:10: warning: Use of memory after it is freed
eUp = regUp->eUp;
^~~~~~~~~~
3 warnings generated.
Version: git
Edited by Erik Faye-Lund