e_comp_wl: close fd if it's allocated newly 84/134484/1
authorBoram Park <boram1288.park@samsung.com>
Mon, 19 Jun 2017 00:32:02 +0000 (09:32 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 19 Jun 2017 00:43:53 +0000 (09:43 +0900)
Change-Id: Id80f461dec2ef71075a427fbe80c8573f9e7e5fe

src/bin/e_comp_wl_rsm.c

index 6b8c20a098ebae2c1679dfe6b257dfa47c7c1ad1..a80469d93dbaf8c5916fb99630dc6877dd282936 100644 (file)
@@ -621,6 +621,18 @@ _remote_surface_buff_send(E_Comp_Wl_Remote_Surface *rs)
 
         buff_type = TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM;
         res = EINA_TRUE;
+
+        /* TODO: if client wants to receive image file for the remote_surfac_provider,
+         * then makes image file from tbm buffer and sends information for that file.
+         * otherwise, just sends tbm buffer to the client.
+         */
+        res = _remote_surface_changed_buff_protocol_send(rs,
+                                                         buff_type,
+                                                         rbuff,
+                                                         _rsm->dummy_fd,
+                                                         (unsigned int)img_size,
+                                                         EINA_FALSE,
+                                                         NULL);
      }
    else
      {
@@ -634,20 +646,21 @@ _remote_surface_buff_send(E_Comp_Wl_Remote_Surface *rs)
 
         buff_type = TIZEN_REMOTE_SURFACE_BUFFER_TYPE_IMAGE_FILE;
         res = EINA_TRUE;
+
+        /* TODO: if client wants to receive image file for the remote_surfac_provider,
+         * then makes image file from tbm buffer and sends information for that file.
+         * otherwise, just sends tbm buffer to the client.
+         */
+        res = _remote_surface_changed_buff_protocol_send(rs,
+                                                         buff_type,
+                                                         rbuff,
+                                                         fd,
+                                                         (unsigned int)img_size,
+                                                         EINA_FALSE,
+                                                         NULL);
+        close(fd);
      }
 
-   /* TODO: if client wants to receive image file for the remote_surfac_provider,
-    * then makes image file from tbm buffer and sends information for that file.
-    * otherwise, just sends tbm buffer to the client.
-    */
-   if (res)
-     res = _remote_surface_changed_buff_protocol_send(rs,
-                                                      buff_type,
-                                                      rbuff,
-                                                      fd,
-                                                      (unsigned int)img_size,
-                                                      EINA_FALSE,
-                                                      NULL);
 
    return res;