C2: Delete mHandle properly to avoid memory leakage

The return in the destructor of C2AllocationGralloc make its mHandle
cannot be deleted properly. Remove the return and add the check for each
resource properly to ensure mHandle can be freed.

Bug: 119925123
Test: Play Youtube without increase inside memory heap
Change-Id: Ifd4f1e405a30b9993082237d6a62b8a60c0cda20
(cherry picked from commit b35cee25a901480099bb1887951b39f2be7c8228)
diff --git a/codec2/vndk/C2AllocatorGralloc.cpp b/codec2/vndk/C2AllocatorGralloc.cpp
index 1b57c72..b0ec5f1 100644
--- a/codec2/vndk/C2AllocatorGralloc.cpp
+++ b/codec2/vndk/C2AllocatorGralloc.cpp
@@ -303,17 +303,18 @@
 }
 
 C2AllocationGralloc::~C2AllocationGralloc() {
-    if (!mBuffer) {
-        return;
-    }
-    if (mLocked) {
+    if (mBuffer && mLocked) {
         // implementation ignores addresss and rect
         uint8_t* addr[C2PlanarLayout::MAX_NUM_PLANES] = {};
         unmap(addr, C2Rect(), nullptr);
     }
-    mMapper->freeBuffer(const_cast<native_handle_t *>(mBuffer));
-    native_handle_delete(const_cast<native_handle_t*>(
-            reinterpret_cast<const native_handle_t*>(mHandle)));
+    if (mBuffer) {
+        mMapper->freeBuffer(const_cast<native_handle_t *>(mBuffer));
+    }
+    if (mHandle) {
+        native_handle_delete(
+                const_cast<native_handle_t *>(reinterpret_cast<const native_handle_t *>(mHandle)));
+    }
 }
 
 c2_status_t C2AllocationGralloc::map(