wim/WimServer/src/WimMemMgmt.cpp
branchRCL_3
changeset 5 3b17fc5c9564
parent 0 164170e6151a
--- a/wim/WimServer/src/WimMemMgmt.cpp	Tue Feb 02 00:44:34 2010 +0200
+++ b/wim/WimServer/src/WimMemMgmt.cpp	Fri Feb 19 23:42:03 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -61,7 +61,7 @@
     CleanupStack::Pop( self );
     return self;
     }
-    
+
 // Destructor
 CWimMemMgmt::~CWimMemMgmt()
     {
@@ -185,7 +185,7 @@
 void CWimMemMgmt::FreeWIMRefs( const RMessage2& aMessage )
     {
     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | Begin"));
-    TUint wimCount = aMessage.Int1(); 
+    TUint wimCount = aMessage.Int1();
     WIMI_Ref_pt ref = reinterpret_cast< WIMI_Ref_pt >( aMessage.Int0() );
     _WIMTRACE3(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | ref 0x%08x, wimCount %d"),
             ref, wimCount);
@@ -193,7 +193,7 @@
     for( TUint8 wimIndex = 0; wimIndex < wimCount; wimIndex++ )
         {
         _WIMTRACE2(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | index=%d"), wimIndex);
-        FreeRef( ref );     // TODO: fix, now deallocating the same ref in each loop?
+        FreeRef( ref );
         }
 
     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | End"));
@@ -225,7 +225,7 @@
             }
         }
     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeRefLst | not found") );
-    aMessage.Complete( KErrNotFound );              
+    aMessage.Complete( KErrNotFound );
     }
 
 // -----------------------------------------------------------------------------
@@ -239,7 +239,7 @@
     for( TUint8 index = 0; index < count; index++ )
         {
         TWimiAllocRef* allocRef = iRefs[ index ];
-        if( allocRef->ref == aRef )
+        if( allocRef && ( allocRef->ref == aRef ) )
             {
             _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::ValidateWIMRefL, valid"));
             return ETrue;