[GRASS-dev] [GRASS GIS] #1318: DebCheck QA: Memory leaks

#1318: DebCheck QA: Memory leaks
------------------------------------------------------------------------+---
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.2
Component: Compiling | Version: 6.4.0
Keywords: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, nviz | Platform: Linux
      Cpu: Unspecified |
------------------------------------------------------------------------+---
Hi,

Debian's run of the Cpp check tool automatically found a number of C-code
errors (or potential errors) which need to be reviewed by hand. See grass-
dev ML thread of 13 Jan 2011.

about:
''Cppcheck is a command-line tool that tries to detect bugs that your
C/C++ compiler doesn't see. It is versatile, and can check non-standard
code including various compiler extensions, inline assembly code, etc. Its
internal preprocessor can handle includes, macros, and several
preprocessor commands. While Cppcheck is highly configurable, you can
start using it just by giving it a path to the source code.''

  http://www.linuxjournal.com/content/daca-could-mean-less-bugs-debian
the list of probably-bugs in the 6.4.0 C/C++ code:
   http://qa.debian.org/daca/cppcheck/squeeze/grass_6.4.0~rc6+42329-3.html
CLI analysis program (not Debian specific):
   http://cppcheck.wiki.sourceforge.net

I have split those 154 hits into 16 classes, and will report each class in
an individual bug report.

Run against releasebranch6_4 r42329 (including all patches up to, but not
beyond, 6.4.0-final)

----

This bug report is for: '''Memory leaks'''

  * ./gem/tools.c:327 [error] - Memory leak: tmp
  * ./gem/tools.c:460 [error] - Memory leak: tmp
  * ./gem/tools.c:526 [error] - Memory leak: tmp
  * ./lib/bitmap/bitmap.c:327 [error] - Memory leak: map
  * ./lib/bitmap/bitmap.c:351 [error] - Memory leak: map.data
  * ./lib/external/shapelib/shpopen.c:849 [error] - Memory leak:
pszBasename
  * ./lib/iostream/mm.cc:304 [error] - Memory leak: p
  * ./lib/iostream/mm.cc:355 [error] - Memory leak: p
  * ./lib/vector/dglib/examples/opt.c:220 [error] - Memory leak: pszArgv
  * ./raster/r.li/r.li.daemon/daemon.c:708 [error] - Memory leak: file_buf
  * ./raster/r.li/r.li.daemon/worker.c:262 [error] - Memory leak: buf
  * ./raster/r.li/r.li.patchdensity/main.c:205 [error] - Memory leak:
mask_buf
  * ./raster/r.li/r.li.patchnum/main.c:181 [error] - Memory leak: mask_buf
  * ./raster/r.li/r.li.shape/main.c:85 [error] - Memory leak: mask_buf
  * ./visualization/nviz/src/togl.c:3548 [error] - Memory leak: pixels

Modules: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, (tcl/tk)
nviz

thanks,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1318&gt;
GRASS GIS <http://grass.osgeo.org>

#1318: DebCheck QA: Memory leaks
------------------------------------------------------------------------+---
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Compiling | Version: 6.4.0
Keywords: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, nviz | Platform: Linux
      Cpu: Unspecified |
------------------------------------------------------------------------+---
Changes (by hamish):

  * milestone: 6.4.2 => 6.4.3

Comment:

visualization/nviz/src/togl.c fixed in devbr6 r55837.

lib/external/shapelib/shpopen.c fixed in trunk and devbr6 with r55838,9.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1318#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1318: DebCheck QA: Memory leaks
------------------------------------------------------------------------+---
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Compiling | Version: 6.4.0
Keywords: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, nviz | Platform: Linux
      Cpu: Unspecified |
------------------------------------------------------------------------+---

Comment(by neteler):

Replying to [comment:1 hamish]:
> lib/external/shapelib/shpopen.c fixed in trunk and devbr6 with r55838,9.

Please also let this get fixed upstream (or open a ticket):

http://svn.osgeo.org/gdal/trunk/gdal/ogr/ogrsf_frmts/shape/shpopen.c

Note that we use a potentially outdated copy of this and related files.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1318#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1318: DebCheck QA: Memory leaks
------------------------------------------------------------------------+---
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Compiling | Version: 6.4.0
Keywords: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, nviz | Platform: Linux
      Cpu: Unspecified |
------------------------------------------------------------------------+---
Changes (by neteler):

  * milestone: 6.4.3 => 6.4.4

Comment:

Replying to [comment:2 neteler]:
> Replying to [comment:1 hamish]:
> > lib/external/shapelib/shpopen.c fixed in trunk and devbr6 with
r55838,9.
>
> Please also let this get fixed upstream (or open a ticket):
>
> http://svn.osgeo.org/gdal/trunk/gdal/ogr/ogrsf_frmts/shape/shpopen.c
>
> Note that we use a potentially outdated copy of this and related files.

See also

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

"grass bundles shapelib"

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1318#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1318: DebCheck QA: Memory leaks
------------------------------------------------------------------------+---
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Compiling | Version: 6.4.0
Keywords: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, nviz | Platform: Linux
      Cpu: Unspecified |
------------------------------------------------------------------------+---
Changes (by volter):

* cc: volter (added)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1318#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1318: DebCheck QA: Memory leaks
------------------------------------------------------------------------+---
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.5
Component: Compiling | Version: 6.4.0
Keywords: gem, lib/bitmap, shapelib, lib/iostream, dglib, r.li, nviz | Platform: Linux
      Cpu: Unspecified |
------------------------------------------------------------------------+---
Changes (by hamish):

  * milestone: 6.4.4 => 6.4.5

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1318#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>