Fix for Memory leaks detected by Valgrind
authorAbhismita Ghosh <g.abhismita@samsung.com>
Wed, 3 Jul 2013 09:04:09 +0000 (18:04 +0900)
committerAbhismita Ghosh <g.abhismita@samsung.com>
Wed, 3 Jul 2013 09:04:09 +0000 (18:04 +0900)
Change-Id: I953f608c66f96751c0b7acc33497e78bdaf27506

src/VpVideoPlayerForm.cpp
src/VpVideoPlayerPresentationModel.cpp

index 174e506..51bfa70 100644 (file)
@@ -1406,15 +1406,19 @@ VideoPlayerForm::SetScreenModeButtonImage(void)
                        {
                                pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_function_icon_screenmode03.png");
                                __pScreenModeButton->SetNormalBitmap(point, *pBitmapScreenMode);
+                               delete pBitmapScreenMode;
                                pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_function_icon_screenmode03_press.png");
                                __pScreenModeButton->SetPressedBitmap(point, *pBitmapScreenMode);
+                               delete pBitmapScreenMode;
                        }
                        else
                        {
                                pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_Function_icon_screenmode_press.png");
                                __pScreenModeButton->SetNormalBitmap(point, *pBitmapScreenMode);
+                               delete pBitmapScreenMode;
                                pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_Function_icon_screenmode_press.png");
                                __pScreenModeButton->SetPressedBitmap(point, *pBitmapScreenMode);
+                               delete pBitmapScreenMode;
                        }
                }
                break;
@@ -1423,8 +1427,10 @@ VideoPlayerForm::SetScreenModeButtonImage(void)
                {
                        pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_function_icon_screenmode02.png");
                        __pScreenModeButton->SetNormalBitmap(point, *pBitmapScreenMode);
+                       delete pBitmapScreenMode;
                        pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_function_icon_screenmode02_press.png");
                        __pScreenModeButton->SetPressedBitmap(point, *pBitmapScreenMode);
+                       delete pBitmapScreenMode;
                }
                break;
 
@@ -1432,17 +1438,16 @@ VideoPlayerForm::SetScreenModeButtonImage(void)
                {
                        pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_function_icon_screenmode03.png");
                        __pScreenModeButton->SetNormalBitmap(point, *pBitmapScreenMode);
+                       delete pBitmapScreenMode;
                        pBitmapScreenMode = pAppResource->GetBitmapN(L"T01-2_function_icon_screenmode03_press.png");
                        __pScreenModeButton->SetPressedBitmap(point, *pBitmapScreenMode);
+                       delete pBitmapScreenMode;
                }
                break;
 
        default:
                break;
        }
-
-       delete pBitmapScreenMode;
-       pBitmapScreenMode = null;
 }
 
 void
@@ -2167,6 +2172,13 @@ VideoPlayerForm::InitAudioRouteList(void)
                        __audioRouteMode = AUDIO_ROUTE_SPEAKER_ONLY;
                }
        }
+
+       if (availableAudioRouteList != null)
+       {
+               availableAudioRouteList->RemoveAll(true);
+               delete availableAudioRouteList;
+               availableAudioRouteList = null;
+       }
 }
 
 result
index 0171968..a6cee97 100755 (executable)
@@ -82,7 +82,14 @@ VideoPlayerPresentationModel::~VideoPlayerPresentationModel(void)
                __pPlayer->Close();
                delete __pPlayer;
        }
-       delete __pMediaPathArrayList;
+
+       if (__pMediaPathArrayList != null)
+       {
+               __pMediaPathArrayList->RemoveAll(true);
+               delete __pMediaPathArrayList;
+               __pMediaPathArrayList = null;
+       }
+
        delete __pCurrentPlayContentPath;
        delete __pFileEventMgr;
 }
@@ -130,8 +137,13 @@ VideoPlayerPresentationModel::Construct(void)
        return r;
 
 CATCH:
-       delete __pMediaPathArrayList;
-       __pMediaPathArrayList = null;
+       if (__pMediaPathArrayList != null)
+       {
+               __pMediaPathArrayList->RemoveAll(true);
+               delete __pMediaPathArrayList;
+               __pMediaPathArrayList = null;
+       }
+
        return r;
 }