diff options
| author | Even Rouault <even.rouault@mines-paris.org> | 2017-05-22 12:37:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-22 12:37:38 +0200 |
| commit | 4e3bd5235009fbcfe5762ba14c0c5c363f29c908 (patch) | |
| tree | d4018f1ed0a53f49c6db62796992c4d64beb0e3a /src | |
| parent | e1ed32922b718fa1a5b46a8fa6b5a42919e013a9 (diff) | |
| parent | 9422539e0b9e9ccd393ca051828bda2e5b8f4beb (diff) | |
| download | PROJ-4e3bd5235009fbcfe5762ba14c0c5c363f29c908.tar.gz PROJ-4e3bd5235009fbcfe5762ba14c0c5c363f29c908.zip | |
Merge pull request #516 from rouault/memleak_fixes
Memleak fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/PJ_wag3.c | 12 | ||||
| -rw-r--r-- | src/pj_init.c | 11 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/PJ_wag3.c b/src/PJ_wag3.c index cd6c18e9..7f5aa4ad 100644 --- a/src/PJ_wag3.c +++ b/src/PJ_wag3.c @@ -28,13 +28,8 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ return lp; } - -static void *freeup_new (PJ *P) { /* Destructor */ - return pj_dealloc(P); -} - static void freeup (PJ *P) { - freeup_new (P); + pj_freeup_plain (P); return; } @@ -43,7 +38,10 @@ PJ *PROJECTION(wag3) { double ts; struct pj_opaque *Q = pj_calloc (1, sizeof (struct pj_opaque)); if (0==Q) - return freeup_new (P); + { + freeup(P); + return 0; + } P->opaque = Q; ts = pj_param (P->ctx, P->params, "rlat_ts").f; diff --git a/src/pj_init.c b/src/pj_init.c index 1f09b0f2..fefcb8fa 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -668,11 +668,6 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) { else PIN->from_greenwich = 0.0; - /* Private object for the geodesic functions */ - PIN->geod = pj_calloc (1, sizeof (struct geod_geodesic)); - if (0!=PIN->geod) - geod_init(PIN->geod, PIN->a, (1 - sqrt (1 - PIN->es))); - /* projection specific initialization */ if (!(PIN = (*proj)(PIN)) || ctx->last_errno) { bum_call: /* cleanup error return */ @@ -685,6 +680,12 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) { } PIN = 0; } + else { + /* Private object for the geodesic functions */ + PIN->geod = pj_calloc (1, sizeof (struct geod_geodesic)); + if (0!=PIN->geod) + geod_init(PIN->geod, PIN->a, (1 - sqrt (1 - PIN->es))); + } return PIN; } |
