aboutsummaryrefslogtreecommitdiff
path: root/src/pj_malloc.c
diff options
context:
space:
mode:
authorThomas Knudsen <busstoptaktik@users.noreply.github.com>2017-10-08 16:29:16 +0200
committerGitHub <noreply@github.com>2017-10-08 16:29:16 +0200
commitcb335699aafc84952d1a6a94eb9d2ee201ad416f (patch)
treea627eaf662c87f4953899504abb3fd4398a86aca /src/pj_malloc.c
parentfaca621657c5c325c54e6f4f7ea2bc6df386b328 (diff)
downloadPROJ-cb335699aafc84952d1a6a94eb9d2ee201ad416f.tar.gz
PROJ-cb335699aafc84952d1a6a94eb9d2ee201ad416f.zip
Resolve #594 and OSS-Fuzz-3569 (#595)
* Resolve #594 and OSS-Fuzz-3569 * Restructure PJ_geos opaque object: sweep_axis showed unneeded, and freeing it was wrong. Eliminate instead Resolves #594 Resolves OSS-Fuzz Issue 3569 Credit to OSS-Fuzz
Diffstat (limited to 'src/pj_malloc.c')
-rw-r--r--src/pj_malloc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pj_malloc.c b/src/pj_malloc.c
index 75d05378..4e465c46 100644
--- a/src/pj_malloc.c
+++ b/src/pj_malloc.c
@@ -158,6 +158,13 @@ void *pj_default_destructor (PJ *P, int errlev) { /* Destructor */
of PJs where the opaque object does not contain any additionally
allocated memory below the P->opaque level.
******************************************************************************/
+
+ /* Even if P==0, we set the errlev on pj_error and the default context */
+ /* Note that both, in the multithreaded case, may then contain undefined */
+ /* values. This is expected behaviour. For MT have one ctx per thread */
+ if (0!=errlev)
+ pj_ctx_set_errno (pj_get_ctx(P), errlev);
+
if (0==P)
return 0;
@@ -179,7 +186,5 @@ void *pj_default_destructor (PJ *P, int errlev) { /* Destructor */
pj_dealloc_params (pj_get_ctx(P), P->params, errlev);
pj_dealloc (P->opaque);
- if (0!=errlev)
- pj_ctx_set_errno (pj_get_ctx(P), errlev);
return pj_dealloc(P);
}