[mapserver-commits] r10661 - in trunk/mapserver: . mapscript/java

svn at osgeo.org svn at osgeo.org
Sun Oct 24 12:10:25 EDT 2010


Author: tamas
Date: 2010-10-24 09:10:25 -0700 (Sun, 24 Oct 2010)
New Revision: 10661

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapscript/java/javamodule.i
Log:
Fix for the memory corruption when mapping the string data type in the Java bindings (3491)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-10-24 16:07:46 UTC (rev 10660)
+++ trunk/mapserver/HISTORY.TXT	2010-10-24 16:10:25 UTC (rev 10661)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fix for the memory corruption when mapping the string data type in the Java bindings (3491)
+
 - Fixed double free in shp2img.c (#3497)
 
 - Fixed number of CGI params is limited to 100 (#3583)

Modified: trunk/mapserver/mapscript/java/javamodule.i
===================================================================
--- trunk/mapserver/mapscript/java/javamodule.i	2010-10-24 16:07:46 UTC (rev 10660)
+++ trunk/mapserver/mapscript/java/javamodule.i	2010-10-24 16:10:25 UTC (rev 10661)
@@ -127,10 +127,19 @@
 	$1 = JNU_GetStringNativeChars(jenv, $input);
 }
 
+/* The default mapping would use ReleaseStringUTFChars to release the
+memory allocated with JNU_GetStringNativeChars which causes a
+memory corruption. (#3491) */
+%typemap(freearg, noblock=1) char * { if ($1) free($1); }
+
 %typemap(out) char * {
 	$result = JNU_NewStringNative(jenv, $1);
 }
 
+%typemap(out) char * {
+	$result = JNU_NewStringNative(jenv, $1);
+}
+
 /*
 ===============================================================================
 RFC-24 implementation follows



More information about the mapserver-commits mailing list