[mapguide-commits] r10131 - in branches/4.0/MgDev/Server/src: Gws/GwsQueryEngine Services/Feature Services/Profiling UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Apr 1 08:08:13 PDT 2025


Author: jng
Date: 2025-04-01 08:08:12 -0700 (Tue, 01 Apr 2025)
New Revision: 10131

Modified:
   branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryDefinition.cpp
   branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsJoinQueryDefinition.cpp
   branches/4.0/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp
   branches/4.0/MgDev/Server/src/Services/Feature/ServerUpdateFeatures.cpp
   branches/4.0/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp
   branches/4.0/MgDev/Server/src/UnitTesting/TestFeatureService.cpp
Log:
Fix some memory leaks from a asan-instrumented debug run of the mgserver test suite on Linux

Modified: branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryDefinition.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryDefinition.cpp	2025-04-01 12:10:45 UTC (rev 10130)
+++ branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsFeatureQueryDefinition.cpp	2025-04-01 15:08:12 UTC (rev 10131)
@@ -85,9 +85,9 @@
 FdoStringCollection* GWSFeatureQueryDefinition::FeatureSourceNames ()
 {
     FdoStringCollection * fsnames = FdoStringCollection::Create ();
-
-    if (m_classname.FeatureSource () != NULL && * m_classname.FeatureSource () != 0) {
-        fsnames->Add (m_classname.FeatureSource ());
+    FdoString* fsname = m_classname.FeatureSource();
+    if (fsname != NULL && * fsname != 0) {
+        fsnames->Add (fsname);
     }
     return fsnames;
 }

Modified: branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsJoinQueryDefinition.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsJoinQueryDefinition.cpp	2025-04-01 12:10:45 UTC (rev 10130)
+++ branches/4.0/MgDev/Server/src/Gws/GwsQueryEngine/GwsJoinQueryDefinition.cpp	2025-04-01 15:08:12 UTC (rev 10131)
@@ -165,14 +165,16 @@
     FdoStringCollection * fsnames = FdoStringCollection::Create ();
     int i;
     for (i = 0; lfsnames != NULL && i < lfsnames->GetCount (); i ++) {
-        if (! fsnames->Contains (lfsnames->GetItem (i))) {
-            fsnames->Add (lfsnames->GetString (i));
+        FdoPtr<FdoStringElement> lfsname = lfsnames->GetItem (i);
+        if (! fsnames->Contains (lfsname)) {
+            fsnames->Add (lfsname->GetString());
         }
     }
 
     for (i = 0; rfsnames != NULL && i < rfsnames->GetCount (); i ++) {
-        if (! fsnames->Contains (rfsnames->GetItem (i))) {
-            fsnames->Add (rfsnames->GetString (i));
+        FdoPtr<FdoStringElement> rfsname = rfsnames->GetItem (i);
+        if (! fsnames->Contains (rfsname)) {
+            fsnames->Add (rfsname->GetString());
         }
     }
     return fsnames;

Modified: branches/4.0/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp	2025-04-01 12:10:45 UTC (rev 10130)
+++ branches/4.0/MgDev/Server/src/Services/Feature/ServerFeatureReader.cpp	2025-04-01 15:08:12 UTC (rev 10131)
@@ -55,7 +55,7 @@
     m_classDef = NULL;
     m_featureSet = NULL;
     m_connection = NULL;
-    m_fdoReader = NULL;
+    FDO_SAFE_RELEASE(m_fdoReader);
     m_removeFromPoolOnDestruction = false;
 }
 

Modified: branches/4.0/MgDev/Server/src/Services/Feature/ServerUpdateFeatures.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Feature/ServerUpdateFeatures.cpp	2025-04-01 12:10:45 UTC (rev 10130)
+++ branches/4.0/MgDev/Server/src/Services/Feature/ServerUpdateFeatures.cpp	2025-04-01 15:08:12 UTC (rev 10131)
@@ -59,7 +59,7 @@
                                                       bool useTransaction)
 {
     Ptr<MgPropertyCollection> propCol;
-    FdoITransaction* transaction = NULL;
+    FdoPtr<FdoITransaction> transaction = NULL;
     bool commited = false;
 
     MG_FEATURE_SERVICE_TRY()

Modified: branches/4.0/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp	2025-04-01 12:10:45 UTC (rev 10130)
+++ branches/4.0/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp	2025-04-01 15:08:12 UTC (rev 10131)
@@ -64,7 +64,7 @@
 
     // Start to profile the ProfileRenderDynamicOverlay process
     double renderMapStart = MgTimerUtil::GetTime(); 
-    m_svcRendering->RenderDynamicOverlay(map, selection, options, pPRMResult.get());
+    Ptr<MgByteReader> res = m_svcRendering->RenderDynamicOverlay(map, selection, options, pPRMResult.get());
     double renderMapEnd = MgTimerUtil::GetTime();
 
     pPRMResult->SetRenderTime(renderMapEnd - renderMapStart);
@@ -103,7 +103,7 @@
 
     // Start to profile the ProfileRenderMap process
     double renderMapStart = MgTimerUtil::GetTime(); 
-    m_svcRendering->RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, pPRMResult.get());
+    Ptr<MgByteReader> res = m_svcRendering->RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, pPRMResult.get());
     double renderMapEnd = MgTimerUtil::GetTime();
 
     pPRMResult->SetRenderTime(renderMapEnd - renderMapStart);

Modified: branches/4.0/MgDev/Server/src/UnitTesting/TestFeatureService.cpp
===================================================================
--- branches/4.0/MgDev/Server/src/UnitTesting/TestFeatureService.cpp	2025-04-01 12:10:45 UTC (rev 10130)
+++ branches/4.0/MgDev/Server/src/UnitTesting/TestFeatureService.cpp	2025-04-01 15:08:12 UTC (rev 10131)
@@ -2313,7 +2313,7 @@
             Ptr<MgInsertFeatures> insertCommand1 = new MgInsertFeatures(L"DaKlass", propCollection);
             
             commands->Add(insertCommand1);
-            pService->UpdateFeatures(featureSource, commands, pTransaction);
+            Ptr<MgPropertyCollection> res = pService->UpdateFeatures(featureSource, commands, pTransaction);
             
             STRING sp = pTransaction->AddSavePoint(L"test");
             STRING sp1 = pTransaction->AddSavePoint(L"test");
@@ -2330,7 +2330,7 @@
             properties3->Add(prop);
             Ptr<MgInsertFeatures> insertCommand2 = new MgInsertFeatures(L"DaKlass", properties3);
             commands->Add(insertCommand2);
-            pService->UpdateFeatures(featureSource, commands, pTransaction);
+            Ptr<MgPropertyCollection> res2 = pService->UpdateFeatures(featureSource, commands, pTransaction);
 
             pTransaction->Rollback(sp);
             pTransaction->Commit();
@@ -2345,6 +2345,7 @@
             {
                 count++;
             }
+            reader->Close();
             REQUIRE(count == 2);
         }
     }



More information about the mapguide-commits mailing list