diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-03-26 14:06:23 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-03-26 14:06:29 +0100 |
| commit | 53aefd520aa7f0607263fa2f2a7b89be81dfeac6 (patch) | |
| tree | f36c2700f96188411791a3390f14878e2965df6d | |
| parent | 4849c52a986e4618ab66649aad9e21789ba6735d (diff) | |
| download | PROJ-53aefd520aa7f0607263fa2f2a7b89be81dfeac6.tar.gz PROJ-53aefd520aa7f0607263fa2f2a7b89be81dfeac6.zip | |
pj_gc_findgrid(): annotate likely memory leak. Coverity CID 193539
| -rw-r--r-- | src/gridcatalog.cpp | 10 | ||||
| -rw-r--r-- | src/proj_internal.h | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/gridcatalog.cpp b/src/gridcatalog.cpp index ca5750ab..15d81dd7 100644 --- a/src/gridcatalog.cpp +++ b/src/gridcatalog.cpp @@ -37,6 +37,13 @@ static PJ_GridCatalog *grid_catalog_list = nullptr; +static +PJ_GRIDINFO *pj_gc_findgrid( projCtx_t *ctx, + PJ_GridCatalog *catalog, int after, + PJ_LP location, double date, + PJ_Region *optional_region, + double *grid_date ); + /************************************************************************/ /* pj_gc_unloadall() */ /* */ @@ -236,6 +243,7 @@ int pj_gc_apply_gridshift( PJ *defn, int inverse, /* pj_c_findgrid() */ /************************************************************************/ +static PJ_GRIDINFO *pj_gc_findgrid( projCtx ctx, PJ_GridCatalog *catalog, int after, PJ_LP location, double date, PJ_Region *optional_region, @@ -287,6 +295,8 @@ PJ_GRIDINFO *pj_gc_findgrid( projCtx ctx, PJ_GridCatalog *catalog, int after, int grid_count = 0; gridlist = pj_gridlist_from_nadgrids( ctx, entry->definition, &grid_count); + // FIXME: this leaks gridlist itself, and memory ownership of + // entry->gridinfo is also confusing. Coverity CID 193539 if( grid_count == 1 ) entry->gridinfo = gridlist[0]; } diff --git a/src/proj_internal.h b/src/proj_internal.h index cdde6bad..880e194f 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -898,12 +898,6 @@ int pj_gc_apply_gridshift( PJ *defn, int inverse, long point_count, int point_offset, double *x, double *y, double *z ); -PJ_GRIDINFO *pj_gc_findgrid( projCtx_t *ctx, - PJ_GridCatalog *catalog, int after, - PJ_LP location, double date, - PJ_Region *optional_region, - double *grid_date ); - double pj_gc_parsedate( projCtx_t *, const char * ); void *proj_mdist_ini(double); |
