fix memory leak with hw video dec 33/83533/1 accepted/tizen/common/20160818.144347 accepted/tizen/ivi/20160818.231821 accepted/tizen/mobile/20160818.231643 accepted/tizen/tv/20160818.231752 accepted/tizen/wearable/20160818.231730 submit/tizen/20160812.084807 submit/tizen/20160818.052348
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 11 Aug 2016 11:27:33 +0000 (20:27 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 11 Aug 2016 11:27:33 +0000 (20:27 +0900)
Change-Id: I0b9544d3b964033df3c527ef0ba71be766a14368

legacy/src/legacy_player.c

index ff189b6..af12640 100644 (file)
@@ -409,20 +409,23 @@ int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user
                return MEDIA_PACKET_FINALIZE;
        }
 
-       if (tsurf && (tbm_surface_get_format(tsurf) == TBM_FORMAT_YUV420)) {
+       if (tsurf) {
+               if (tbm_surface_get_format(tsurf) == TBM_FORMAT_YUV420) {
 #define NUM_OF_SW_CODEC_BO 1
-               int bo_num = 0;
-               tbm_bo bo = NULL;
-
-               bo_num = tbm_surface_internal_get_num_bos(tsurf);
-               if (bo_num == NUM_OF_SW_CODEC_BO) {
-                       bo = tbm_surface_internal_get_bo(tsurf, 0);
-                       if (bo) {
-                               mm_player_release_video_stream_bo(handle->mm_handle, bo);
-                       } else {
-                               LOGE("bo is NULL");
+                       int bo_num = 0;
+                       tbm_bo bo = NULL;
+
+                       bo_num = tbm_surface_internal_get_num_bos(tsurf);
+                       if (bo_num == NUM_OF_SW_CODEC_BO) {
+                               bo = tbm_surface_internal_get_bo(tsurf, 0);
+                               if (bo) {
+                                       mm_player_release_video_stream_bo(handle->mm_handle, bo);
+                               } else {
+                                       LOGE("bo is NULL");
+                               }
                        }
                }
+
                tbm_surface_destroy(tsurf);
                tsurf = NULL;
        }