[mapserver-commits] r9556 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Nov 19 09:10:56 EST 2009


Author: aboudreault
Date: 2009-11-19 09:10:54 -0500 (Thu, 19 Nov 2009)
New Revision: 9556

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maporaclespatial.c
Log:
Fixed Oracle FastCGI memory leak (#3187)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-11-18 16:16:42 UTC (rev 9555)
+++ trunk/mapserver/HISTORY.TXT	2009-11-19 14:10:54 UTC (rev 9556)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed Oracle FastCGI memory leak (#3187)
+ 
 - layer->project flag not being reset properly for drawquerylayer (#673 #2079)
 
 - OGC SLD: support multi-polygons geometries for filters embedded in an SLD (#3097)

Modified: trunk/mapserver/maporaclespatial.c
===================================================================
--- trunk/mapserver/maporaclespatial.c	2009-11-18 16:16:42 UTC (rev 9555)
+++ trunk/mapserver/maporaclespatial.c	2009-11-19 14:10:54 UTC (rev 9556)
@@ -120,6 +120,8 @@
 		OCISvcCtx *svchp;
 		int last_oci_status;
 		text last_oci_error[2048];
+	        /* This references counter is to avoid the cache freed if there are other layers that could use it */
+	        int ref_count;
 	} msOracleSpatialHandler;
 
 typedef
@@ -592,6 +594,7 @@
     }
     memset( hand, 0, sizeof(msOracleSpatialHandler) );
 
+    hand->ref_count = 1;
     hand->last_oci_status = MS_SUCCESS;
     hand->last_oci_error[0] = (text)'\0';
 
@@ -1791,6 +1794,7 @@
     }
     else
     {
+        hand->ref_count++;
         hand->last_oci_status = MS_SUCCESS;
         hand->last_oci_error[0] = (text)'\0';
     }
@@ -1866,6 +1870,11 @@
         msOCICloseDataHandlers( layerinfo->oradatahandlers );
         layerinfo->oradatahandlers = NULL;
 
+	/* Free the OCI cache only if there is no more layer that could use it */
+	layerinfo->orahandlers->ref_count--;
+	if (layerinfo->orahandlers->ref_count == 0)
+	  OCICacheFree (layerinfo->orahandlers->envhp, layerinfo->orahandlers->errhp, layerinfo->orahandlers->svchp);
+
         /* Release Mapserver Pool */
         if (layer->debug)
           msDebug("msOracleSpatialLayerClose. Release the Oracle Pool.\n");



More information about the mapserver-commits mailing list