diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2016-08-10 15:34:01 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2016-08-10 15:34:01 +0900 |
commit | 61b32dedbdbfc5360e98afa7f42dcf32fd2b758c (patch) | |
tree | 83b91f4c607c7b52c274cc8d8eff4267e740ec4a | |
parent | 3b9b49d27a189a7e20fa499b546f77296daba281 (diff) | |
download | camera-61b32dedbdbfc5360e98afa7f42dcf32fd2b758c.tar.gz camera-61b32dedbdbfc5360e98afa7f42dcf32fd2b758c.tar.bz2 camera-61b32dedbdbfc5360e98afa7f42dcf32fd2b758c.zip |
[Release version 0.2.67] Add error handling code in handle creation functionsubmit/tizen/20160811.023523submit/tizen/20160810.075454accepted/tizen/wearable/20160812.010530accepted/tizen/tv/20160812.010605accepted/tizen/mobile/20160812.010649accepted/tizen/ivi/20160812.010627accepted/tizen/common/20160811.145643
Change-Id: I6eac7491626504fab9efae7360fd3cbc121e9e44
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 36 |
2 files changed, 31 insertions, 7 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 2bf72be..690d971 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.2.66 +Version: 0.2.67 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 402a45c..5e3bc83 100644 --- a/src/camera.c +++ b/src/camera.c @@ -2153,7 +2153,8 @@ int _camera_stop_evas_rendering(camera_h camera, bool keep_screen) int camera_create(camera_device_e device, camera_h *camera) { int sock_fd = -1; - char *sndMsg; + char *send_msg = NULL; + int send_ret = 0; int ret = CAMERA_ERROR_NONE; int pid = 0; camera_cli_s *pc = NULL; @@ -2183,14 +2184,28 @@ int camera_create(camera_device_e device, camera_h *camera) pid = getpid(); - sndMsg = muse_core_msg_json_factory_new(api, + send_msg = muse_core_msg_json_factory_new(api, MUSE_TYPE_INT, "module", muse_module, MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type, MUSE_TYPE_INT, "pid", pid, 0); - muse_core_ipc_send_msg(sock_fd, sndMsg); - muse_core_msg_json_factory_free(sndMsg); + if (!send_msg) { + LOGE("NULL msg"); + ret = CAMERA_ERROR_OUT_OF_MEMORY; + goto ErrorExit; + } + + send_ret = muse_core_ipc_send_msg(sock_fd, send_msg); + + muse_core_msg_json_factory_free(send_msg); + send_msg = NULL; + + if (send_ret < 0) { + LOGE("send msg failed %d", errno); + ret = CAMERA_ERROR_INVALID_OPERATION; + goto ErrorExit; + } pc = g_new0(camera_cli_s, 1); if (pc == NULL) { @@ -2206,6 +2221,8 @@ int camera_create(camera_device_e device, camera_h *camera) goto ErrorExit; } + sock_fd = -1; + LOGD("cb info : %d", pc->cb_info->fd); ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT); @@ -2239,9 +2256,16 @@ ErrorExit: tbm_bufmgr_deinit(bufmgr); bufmgr = NULL; + if (sock_fd > -1) { + muse_core_connection_close(sock_fd); + sock_fd = -1; + } + if (pc) { - _client_callback_destroy(pc->cb_info); - pc->cb_info = NULL; + if (pc->cb_info) { + _client_callback_destroy(pc->cb_info); + pc->cb_info = NULL; + } g_free(pc); pc = NULL; } |