e_comp_hwc: unmap the copied_buffer after copied buffer 66/78866/3
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 7 Jul 2016 07:17:01 +0000 (16:17 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 7 Jul 2016 08:14:00 +0000 (17:14 +0900)
Change-Id: Ia0f201e0981f9b57fd85458750f1b30ee33f54af

src/bin/e_comp_hwc.c

index f6a2edd0d737f6d4dd6fb650857fbb05a23e26f7..94b7dfcd6d18d0b5e8e7b958a6db1b6f0cb38898 100644 (file)
@@ -163,14 +163,15 @@ _e_comp_hwc_create_copied_surface(E_Client *ec, Eina_Bool refresh)
    EINA_SAFETY_ON_NULL_RETURN_VAL(tsurface, NULL);
 
    tbm_surface_map(tsurface, TBM_SURF_OPTION_READ, &src_info);
-   tbm_surface_unmap(tsurface);
    EINA_SAFETY_ON_NULL_RETURN_VAL(src_info.planes[0].ptr, NULL);
 
    new_tsurface = tbm_surface_create(src_info.width, src_info.height, src_info.format);
-
    tbm_surface_map(new_tsurface, TBM_SURF_OPTION_WRITE, &dst_info);
-   tbm_surface_unmap(new_tsurface);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(dst_info.planes[0].ptr, NULL);
+   if (!dst_info.planes[0].ptr)
+     {
+        tbm_surface_unmap(tsurface);
+        return NULL;
+     }
 
    /* copy from src to dst */
 #if HAVE_MEMCPY_SWC
@@ -179,6 +180,9 @@ _e_comp_hwc_create_copied_surface(E_Client *ec, Eina_Bool refresh)
    memcpy(dst_info.planes[0].ptr, src_info.planes[0].ptr, src_info.planes[0].size);
 #endif
 
+   tbm_surface_unmap(new_tsurface);
+   tbm_surface_unmap(tsurface);
+
    return new_tsurface;
 }