[opengtl-commits] [647] free more memory, and correctly initialize list of regions |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 647
Author: cyrille
Date: 2009-03-17 15:58:43 +0100 (Tue, 17 Mar 2009)
Log Message:
-----------
free more memory, and correctly initialize list of regions
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/RegionWrap_p.h
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp 2009-03-17 14:58:16 UTC (rev 646)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp 2009-03-17 14:58:43 UTC (rev 647)
@@ -158,10 +158,12 @@
{
GTLCore::Function* changedFunction = Library::d->m_moduleData->function( name(), "changed");
RegionWrap* (*func)( RegionWrap*, int, ArrayWrap* ) = ( RegionWrap* (*)( RegionWrap*, int, ArrayWrap* ) )GTLCore::VirtualMachine::instance()->getPointerToFunction( changedFunction, 3);
- RegionWrap* rwrap = (*func)( regionToRegionWrap( changed_input_region ), input_index, regionListToArrayWrap( input_DOD ) );
+ ArrayWrap* aw = regionListToArrayWrap( input_DOD );
+ RegionWrap* rwrap = (*func)( regionToRegionWrap( changed_input_region ), input_index, aw ); // TODO leak
GTLCore::Region region = regionWrapToRegion( rwrap );
gtlFree( rwrap );
+ gtlFreeAllArray<RegionWrap*>( aw );
return region;
}
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/RegionWrap_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/RegionWrap_p.h 2009-03-17 14:58:16 UTC (rev 646)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/RegionWrap_p.h 2009-03-17 14:58:43 UTC (rev 647)
@@ -68,13 +68,12 @@
inline ArrayWrap* regionListToArrayWrap( const std::list<GTLCore::Region> & regions)
{
ArrayWrap* array = gtlAllocateArray<RegionWrap*>( regions.size() );
- RegionWrap* wrapData = reinterpret_cast<RegionWrap*>(array->data);
+ RegionWrap** wrapData = reinterpret_cast<RegionWrap**>(array->data);
for( std::list<GTLCore::Region>::const_iterator it = regions.begin(); it != regions.end(); ++it, ++wrapData)
{
- wrapData = regionToRegionWrap( *it );
+ *wrapData = regionToRegionWrap( *it );
}
return array;
}
-
#endif