Fix dmabuf memory leak 37/298437/1 accepted/tizen/unified/20230913.172610
authorPaweł Stawicki <p.stawicki@samsung.com>
Wed, 30 Aug 2023 15:18:17 +0000 (17:18 +0200)
committereunhae choi <eunhae1.choi@samsung.com>
Thu, 7 Sep 2023 03:31:32 +0000 (03:31 +0000)
Change-Id: Iaff9d750fd00181ca5f86015b36c562d72a4e6b5
(cherry picked from commit 2ec5821bc74212cb0ab4fe5f41590bc5ad549d1f)

src/esplusplayer/include_internal/esplayer/decoded_pkt_list.h

index 4a7ce6c..fd4614e 100644 (file)
 
 namespace {
 void DecodedPacketDeleter(esplusplayer_decoded_video_packet* packet) {
-  if (packet == nullptr || packet->surface_data == nullptr) return;
+  if (packet == nullptr) return;
   // LOG_DEBUG("packet[%p] deleted", packet);
   if(packet->private_data) { // hw dec
     gst_buffer_unref((GstBuffer *)packet->private_data);
     packet->private_data = nullptr;
-  } else {
+  }
+  if(packet->surface_data) {
     tbm_surface_destroy(static_cast<tbm_surface_h>(packet->surface_data));
-    packet->surface_data = NULL;
+    packet->surface_data = nullptr;
   }
 }
 }  // namespace