Permalink
Browse files

Fix thread safety issue in msLoadMapFromString (#4523)

The `TLOCK_PARSER` thread mutex is now released after the call to
`msyylex_destroy()` which otherwise clobbers global lexer variables
that may be in use in another thread.

closes #4523
  • Loading branch information...
1 parent 82da39e commit e9e48941e9b02378de57a8ad6c6aa0d070816b06 @homme homme committed with tbonfort Nov 13, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 mapfile.c
View
@@ -5939,6 +5939,10 @@ mapObj *msLoadMapFromString(char *buffer, char *new_mappath)
if(mappath != NULL) free(mappath);
return NULL;
}
+
+ if (mappath != NULL) free(mappath);
+ msyylex_destroy();
+
msReleaseLock( TLOCK_PARSER );
if (debuglevel >= MS_DEBUGLEVEL_TUNING) {
@@ -5949,9 +5953,6 @@ mapObj *msLoadMapFromString(char *buffer, char *new_mappath)
(starttime.tv_sec+starttime.tv_usec/1.0e6) );
}
- if (mappath != NULL) free(mappath);
- msyylex_destroy();
-
if (resolveSymbolNames(map) == MS_FAILURE) return NULL;
return map;

0 comments on commit e9e4894

Please sign in to comment.