From: Eunhae Choi Date: Wed, 14 Mar 2018 08:40:28 +0000 (+0900) Subject: [0.3.85] fix the coverity issues X-Git-Tag: submit/tizen/20180315.045512^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d80a0c3e451be3e4189f52bc78c5aa8ed5e9ce9a;p=platform%2Fcore%2Fapi%2Fplayer.git [0.3.85] fix the coverity issues Change-Id: Ic7d18597cdfebc24aab903051a47ebd864f0bed2 --- diff --git a/include/player_msg.h b/include/player_msg.h index 81abec9..ace8536 100644 --- a/include/player_msg.h +++ b/include/player_msg.h @@ -677,8 +677,9 @@ do { \ * @param[in] param1 the name of param is key, must be local variable. never be pointer. * @param[in] type2 The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY) * @param[in] param2 the name of param is key, must be local variable. never be pointer. + * @param[out] ret set ERROR when fail to send msg. */ -#define player_msg_create_handle(api, fd, type1, param1, type2, param2) \ +#define player_msg_create_handle(api, fd, type1, param1, type2, param2, ret) \ do { \ char *__sndMsg__; \ int __len__; \ @@ -692,7 +693,7 @@ do { \ muse_core_msg_free(__sndMsg__); \ if (__len__ <= 0) { \ LOGE("sending message failed"); \ - return PLAYER_ERROR_INVALID_OPERATION; \ + ret = PLAYER_ERROR_INVALID_OPERATION; \ } \ } while (0) diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 4eab1c3..4a78547 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.84 +Version: 0.3.85 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 32910cb..028a12d 100644 --- a/src/player.c +++ b/src/player.c @@ -1737,7 +1737,9 @@ int player_create(player_h * player) goto ERROR; } - player_msg_create_handle(api, sock_fd, INT, module, INT, pid); + player_msg_create_handle(api, sock_fd, INT, module, INT, pid, ret); + if (ret == PLAYER_ERROR_INVALID_OPERATION) + goto ERROR; pc->cb_info = callback_new(sock_fd); if (!pc->cb_info) { @@ -4035,7 +4037,10 @@ int player_push_media_stream(player_h player, media_packet_h packet) #endif if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_RAW) { buf_size = (int)push_media.size; - muse_client_ipc_push_data(pc->cb_info->data_fd, buf, buf_size, push_media.pts); + if (muse_client_ipc_push_data(pc->cb_info->data_fd, buf, buf_size, push_media.pts) < 0) { + LOGE("failed to send data"); + return PLAYER_ERROR_INVALID_OPERATION; + } player_msg_send_array(api, pc, ret_buf, ret, push_media_msg, msg_size, sizeof(char)); } diff --git a/test/player_audio_test.c b/test/player_audio_test.c index 8ed65b6..ac8493a 100644 --- a/test/player_audio_test.c +++ b/test/player_audio_test.c @@ -357,7 +357,11 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data) media_packet_destroy(g_audio_pkt); g_audio_pkt = NULL; } - media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt); + + if (media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt) != MEDIA_PACKET_ERROR_NONE) { + g_print("media_packet_create_alloc failed\n"); + goto EXIT; + } g_print("packet = %p, src = %p\n", g_audio_pkt, src); diff --git a/test/player_es_push_test.c b/test/player_es_push_test.c index 4d40918..f51d313 100644 --- a/test/player_es_push_test.c +++ b/test/player_es_push_test.c @@ -326,7 +326,10 @@ int bytestream2nalunit(FILE * fd, unsigned char *nal) } } - fseek(fd, -(zero_count + 1), SEEK_CUR); + if (fseek(fd, -(zero_count + 1), SEEK_CUR) < 0) { + LOGE("failed fseek"); + return -1; + } if (nal_unit_type == 0x7) { sps_len = nal_length; diff --git a/test/player_test.c b/test/player_test.c index 326f75a..3826f60 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -860,7 +860,10 @@ static void buffer_need_video_data_cb(unsigned int size, void *user_data) g_video_pkt = NULL; } - media_packet_create_alloc(g_video_fmt, NULL, NULL, &g_video_pkt); + if (media_packet_create_alloc(g_video_fmt, NULL, NULL, &g_video_pkt) != MEDIA_PACKET_ERROR_NONE) { + g_print("media_packet_create_alloc failed\n"); + goto EXIT; + } g_print("packet = %p, src = %p\n", g_video_pkt, src); @@ -934,7 +937,11 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data) media_packet_destroy(g_audio_pkt); g_audio_pkt = NULL; } - media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt); + + if (media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt) != MEDIA_PACKET_ERROR_NONE) { + g_print("media_packet_create_alloc failed\n"); + goto EXIT; + } g_print("packet = %p, src = %p\n", g_audio_pkt, src);