Fix memory leak 2.1b_release accepted/tizen_2.1/20130425.034723 submit/tizen_2.1/20130424.232555
authorWoowon <woowon.park@samsung.com>
Tue, 23 Apr 2013 05:24:55 +0000 (14:24 +0900)
committerWoowon <woowon.park@samsung.com>
Tue, 23 Apr 2013 05:38:56 +0000 (14:38 +0900)
Change-Id: Iacd3e518234a33949ba3cc312086dbf5d197ebe8
Signed-off-by: Woowon <woowon.park@samsung.com>
src/FNetNfc_NfcManagerImpl.cpp
src/FNetNfc_TagConnectionImpl.cpp

index e8527cd..e8533d1 100644 (file)
@@ -86,8 +86,45 @@ _NfcManagerImpl::~_NfcManagerImpl(void)
 
        delete __pCurrentTagImpl;
        delete __pMgrEvent;
+
+       unique_ptr<IList> pTagConditionList(__pTagConditionMap->GetValuesN());
+       unique_ptr<IEnumerator> pTagConditionEnum(pTagConditionList->GetEnumeratorN());
+       while (pTagConditionEnum->MoveNext() == E_SUCCESS)
+       {
+               _NfcTagEventMap* pEventMap = dynamic_cast <_NfcTagEventMap*> (pTagConditionEnum->GetCurrent());
+               if (pEventMap)
+               {
+                       unique_ptr<IListT<_NfcTagDiscoveryEvent*> > pEventList(pEventMap->GetValuesN());
+                       unique_ptr<IEnumeratorT<_NfcTagDiscoveryEvent*> > pEventEnum(pEventList->GetEnumeratorN());
+                       while (pEventEnum->MoveNext() == E_SUCCESS)
+                       {
+                               _NfcTagDiscoveryEvent* pEvent = null;
+                               pEventEnum->GetCurrent(pEvent);
+                               delete pEvent;
+                       }
+               }
+       }
        delete __pTagConditionMap;
+
+       unique_ptr<IList> pNdefConditionList(__pNdefConditionMap->GetValuesN());
+       unique_ptr<IEnumerator> pNdefConditionEnum(pNdefConditionList->GetEnumeratorN());
+       while (pNdefConditionEnum->MoveNext() == E_SUCCESS)
+       {
+               _NdefMsgEventMap* pEventMap = dynamic_cast <_NdefMsgEventMap*> (pNdefConditionEnum->GetCurrent());
+               if (pEventMap)
+               {
+                       unique_ptr<IListT<_NdefMessageDiscoveryEvent*> > pEventList(pEventMap->GetValuesN());
+                       unique_ptr<IEnumeratorT<_NdefMessageDiscoveryEvent*> > pEventEnum(pEventList->GetEnumeratorN());
+                       while (pEventEnum->MoveNext() == E_SUCCESS)
+                       {
+                               _NdefMessageDiscoveryEvent* pEvent = null;
+                               pEventEnum->GetCurrent(pEvent);
+                               delete pEvent;
+                       }
+               }
+       }
        delete __pNdefConditionMap;
+
        delete __pDeviceDiscoveryEvent;
 }
 
index b5c5bf8..cd48649 100644 (file)
@@ -61,6 +61,7 @@ _TagConnectionImpl::~_TagConnectionImpl(void)
        }
 
        delete __pTargetTag;
+       delete __pConnEvent;
 }
 
 result