[GRASS-git] [OSGeo/grass] 2bb77e: Fix uninitialized, scope, leak, const issues in C ...

Loïc Bartoletti noreply at github.com
Thu Mar 17 15:34:42 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 2bb77ed6a481cf5e82ec323a6d9ee4dacbd306f3
      https://github.com/OSGeo/grass/commit/2bb77ed6a481cf5e82ec323a6d9ee4dacbd306f3
  Author: Loïc Bartoletti <lbartoletti at users.noreply.github.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M imagery/i.atcorr/main.cpp
    M imagery/i.atcorr/output.h
    M imagery/i.atcorr/transform.cpp
    M imagery/i.atcorr/transform.h
    M include/grass/defs/ogsf.h
    M include/grass/iostream/mm_utils.h
    M lib/bitmap/bitmap.c
    M lib/bitmap/sparse.c
    M lib/calc/xmode.c
    M lib/calc/xnmode.c
    M lib/gis/make_loc.c
    M lib/iostream/mm_utils.cpp
    M lib/ogsf/gs3.c
    M lib/rst/data/dataquad.c
    M lib/vector/dglib/examples/cr_from_a.c
    M raster/r.terraflow/fill.cpp
    M raster/r.terraflow/sweep.h
    M raster/r.terraflow/water.h
    M raster/r.viewshed/distribute.cpp
    M raster/r.viewshed/distribute.h
    M raster/r.viewshed/rbbst.cpp
    M raster/r.viewshed/rbbst.h
    M raster/r.viewshed/visibility.cpp
    M raster/r.viewshed/visibility.h

  Log Message:
  -----------
  Fix uninitialized, scope, leak, const issues in C (#2250)

* make_loc.c: reduce the scope of the variable 'path'
* make_loc.c: remove useless assignment of l_1 and l_2 since they are overwritten after
* make_loc.c: l_1 and l_2 are already checked before
* xmode.c: mode: initialize mode_v to avoid a false-positive warning
* xnmode.c: mode: initialize mode_v to avoid a false-positive warning
* gs3.c: Gs_update_attrange: initialize min and max to avoid a false-positive warning
* gs3.c: Gs_load_3dview: reduce scope of the variable 'pt'
* gs3.c: Gs_load_3dview: const geosurf
* mm_utils: MEMORY_LOG: pass str by reference
* dataquad.c: quad_data_new: fix memory leak data
* dataquad.c: quad_compare: avoid use of null data
* dataquad.c: quad_add_data: reduce scope of variables
* cr_from_a.c: main: fix resource leak: fp
* i.atcorr: various const ref performance
* bitmap.c: fix memory leak CWE: 401
* bitmap/sparse.c: fix memory leak CWE: 401
* sparse.c: BM_set_sparse: Tcount is never used
* sparse.c: BM_file_write_sparse: reduce scope of cnt
* r.terraflow/sweep.h: performs initialization in initialization list
* add missing const, various const ref performance

Issues detected by clang and cppcheck.




More information about the grass-commit mailing list