[0.3.78] release pc in case of data_ch creation failure 04/157504/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 25 Oct 2017 00:04:52 +0000 (09:04 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 25 Oct 2017 00:04:52 +0000 (09:04 +0900)
Change-Id: I1a457858f9ec070fdabd76cd20c2653fff96b24e

include/player_msg.h
packaging/capi-media-player.spec
src/player.c

index 929afc3..81abec9 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
  * @param[in] module The server side module infomation.
  * @param[in] fd socket fd
  */
-#define muse_core_send_module_addr(module, fd) \
+#define muse_core_send_module_addr(module, fd, ret) \
        do {\
                char *__sndMsg__; \
                int __len__; \
@@ -40,7 +40,8 @@ extern "C" {
                muse_core_msg_free(__sndMsg__); \
                if (__len__ <= 0) { \
                        LOGE("sending message failed"); \
-                       return PLAYER_ERROR_INVALID_OPERATION; \
+                       ret = PLAYER_ERROR_INVALID_OPERATION; \
+                       goto ERROR; \
                } \
        } while (0)
 
index 3d09da1..9423d7d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.77
+Version:    0.3.78
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index f146569..8af69e5 100644 (file)
@@ -1761,15 +1761,22 @@ int player_create(player_h * player)
                        *player = (player_h) pc;
                        if (player_msg_get_type(module_addr, ret_buf, POINTER)) {
                                pc->cb_info->data_fd = muse_client_new_data_ch();
-                               muse_core_send_module_addr(module_addr, pc->cb_info->data_fd);
+                               if (!muse_core_fd_is_valid(pc->cb_info->data_fd)) {
+                                       LOGE("Failed to get data_fd");
+                                       ret = PLAYER_ERROR_INVALID_OPERATION;
+                                       goto ERROR;
+                               }
+
+                               muse_core_send_module_addr(module_addr, pc->cb_info->data_fd, ret);
                                LOGD("Data channel fd %d, muse module addr %p", pc->cb_info->data_fd, module_addr);
                        } else {
                                ret = PLAYER_ERROR_INVALID_OPERATION;
                                goto ERROR;
                        }
                        SERVER_TIMEOUT(pc) = MAX_SERVER_TIME_OUT; /* will be update after prepare phase. */
-               } else
+               } else {
                        goto ERROR;
+               }
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
                pc->cb_info->evas_info = g_new0(player_evas_info_s, 1);
                if (pc->cb_info->evas_info == NULL) {