Skip to content

Commit

Permalink
fix memory leak with proj >= 4.8.0 (#4398)
Browse files Browse the repository at this point in the history
fixes #4398
  • Loading branch information
tbonfort committed Jul 18, 2012
1 parent bdefa75 commit 479dc7c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mapfile.c
Expand Up @@ -1034,6 +1034,9 @@ int msInitProjection(projectionObj *p)
p->proj = NULL;
p->args = (char **)malloc(MS_MAXPROJARGS*sizeof(char *));
MS_CHECK_ALLOC(p->args, MS_MAXPROJARGS*sizeof(char *), -1);
#if PJ_VERSION >= 480
p->proj_ctx = NULL;
#endif
#endif
return(0);
}
Expand All @@ -1042,14 +1045,15 @@ void msFreeProjection(projectionObj *p)
{
#ifdef USE_PROJ
if(p->proj) {
#if PJ_VERSION < 480
pj_free(p->proj);
#else
p->proj = NULL;
}
#if PJ_VERSION >= 480
if(p->proj_ctx) {
pj_ctx_free(p->proj_ctx);
p->proj_ctx = NULL;
#endif
p->proj = NULL;
}
#endif

msFreeCharArray(p->args, p->numargs);
p->args = NULL;
Expand Down

0 comments on commit 479dc7c

Please sign in to comment.