pp: close open src fd if dst fd get failed 34/198634/1
authorJunkyeong Kim <jk0430.kim@samsung.com>
Mon, 28 Jan 2019 08:06:52 +0000 (17:06 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Mon, 28 Jan 2019 08:07:17 +0000 (17:07 +0900)
Change-Id: I49bdd01634713d93df554172c43ffe1b36d87834
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tdm_nexell_pp.c

index 925472ef94c546d85f5db709acd039c4367480f9..944d4920135c9b39c8ec6eb953d8de03bd7675d5 100644 (file)
@@ -120,9 +120,17 @@ _tdm_nexell_pp_convert(tdm_nexell_pp_buffer *buffer, tdm_info_pp *info, int drm_
        ctx.src_fds[2] = ctx.src_fds[0];
 
        bo_dst = tbm_surface_internal_get_bo(buffer->dst, 0);
-       RETURN_VAL_IF_FAIL(bo_dst != NULL, TDM_ERROR_OPERATION_FAILED);
+       if (bo_dst == NULL) {
+               close(ctx.src_fds[0]);
+               return TDM_ERROR_OPERATION_FAILED;
+       }
        handle_dst = (__u32)tbm_bo_get_handle(bo_dst, TBM_DEVICE_DEFAULT).u32;
        ctx.dst_fds[0] = _tdm_gem_to_dmafd(drm_fd, handle_dst);
+       if (ctx.dst_fds[0] < 0) {
+               close(ctx.src_fds[0]);
+               return TDM_ERROR_OPERATION_FAILED;
+       }
+
        ctx.dst_fds[1] = ctx.dst_fds[0];
        ctx.dst_fds[2] = ctx.dst_fds[0];