From: Sangchul Lee Date: Mon, 12 Oct 2020 08:48:45 +0000 (+0900) Subject: Add missing g_array_unref() X-Git-Tag: submit/tizen/20210729.023123~204 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F245555%2F1;p=platform%2Fcore%2Fapi%2Fwebrtc.git Add missing g_array_unref() It should be called after getting GArray pointer from 'get-transceivers' of webrtcbin. [Version] 0.1.38 [Issue Type] Bug fix Change-Id: I10564beba8579e59be95e475c9f38fd1baa733ab Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 739fc69a..b2c2ef5e 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.1.37 +Version: 0.1.38 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index 9d60e579..1583a7cf 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -996,7 +996,7 @@ static int __convert_direction(GstWebRTCRTPTransceiverDirection gst_direction, w int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction) { - int ret = WEBRTC_ERROR_NONE; + int ret = WEBRTC_ERROR_INVALID_OPERATION; webrtc_gst_slot_s *source; GstWebRTCRTPTransceiver *trans; GArray *transceivers; @@ -1025,21 +1025,24 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i); if (trans->mline == mline) { ret = __convert_direction(trans->direction, direction); - if (ret != WEBRTC_ERROR_NONE) - return ret; - LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]", - trans, i, trans->mline, trans->mid, __direction_str[*direction]); - return WEBRTC_ERROR_NONE; + if (ret == WEBRTC_ERROR_NONE) + LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]", + trans, i, trans->mline, trans->mid, __direction_str[*direction]); + goto end; } } LOG_ERROR("could not find a transceiver with mline[%d]", mline); - return WEBRTC_ERROR_INVALID_OPERATION; +end: + g_array_unref(transceivers); + + return ret; } int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction) { + int ret = WEBRTC_ERROR_INVALID_OPERATION; webrtc_gst_slot_s *source; GstWebRTCRTPTransceiver *trans; GArray *transceivers; @@ -1070,13 +1073,17 @@ int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ trans->direction = __direction_gst[direction]; LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]", trans, i, trans->mline, __direction_str[direction]); - return WEBRTC_ERROR_NONE; + ret = WEBRTC_ERROR_NONE; + goto end; } } LOG_ERROR("could not find a transceiver with mline[%d]", mline); - return WEBRTC_ERROR_INVALID_OPERATION; +end: + g_array_unref(transceivers); + + return ret; } void _webrtcbin_on_negotiation_needed(GstElement *webrtcbin, gpointer user_data)