aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-06-03 11:29:56 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-06-03 11:29:56 +0200
commit85512dd3a782cf04520fe11b645de8e4ef42932d (patch)
tree73e4bb006a3235f0e45c0b2b9b9fd777826355ed /src
parent1c80b05e007340ed213e7f492b73631810e8aec4 (diff)
downloadPROJ-85512dd3a782cf04520fe11b645de8e4ef42932d.tar.gz
PROJ-85512dd3a782cf04520fe11b645de8e4ef42932d.zip
proj_cleanup(): make sure it frees the database context of the default PJ_CONTEXT
Diffstat (limited to 'src')
-rw-r--r--src/malloc.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/malloc.cpp b/src/malloc.cpp
index 4727f478..d60a3f92 100644
--- a/src/malloc.cpp
+++ b/src/malloc.cpp
@@ -33,6 +33,9 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
+#ifndef FROM_PROJ_CPP
+#define FROM_PROJ_CPP
+#endif
/* allocate and deallocate memory */
/* These routines are used so that applications can readily replace
@@ -46,6 +49,8 @@
#include <new>
+#include "proj/internal/io_internal.hpp"
+
#include "proj.h"
#include "proj_internal.h"
#include "grids.hpp"
@@ -176,6 +181,13 @@ PJ *pj_default_destructor (PJ *P, int errlev) { /* Destructor */
/*****************************************************************************/
void proj_cleanup() {
/*****************************************************************************/
+
+ // Close the database context of the default PJ_CONTEXT
+ auto cpp_context = pj_get_default_ctx()->cpp_context;
+ if( cpp_context ) {
+ cpp_context->closeDb();
+ }
+
pj_clear_initcache();
FileManager::clearMemoryCache();
pj_clear_hgridshift_knowngrids_cache();