From 50004893110398639daad7d5a40f459b3e89b8ab Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Thu, 4 Feb 2021 18:47:39 +0900 Subject: [PATCH] webrtc_source: Add missing unref call of the media format when an error occurs [Version] 0.1.108 [Issue Type] Bug fix Change-Id: I79fcbe483146e4463196588e30a27af6231afd0a Signed-off-by: Sangchul Lee --- packaging/capi-media-webrtc.spec | 2 +- src/webrtc_source.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 89ee6aa4..4e89fa91 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.107 +Version: 0.1.108 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index b89851e3..c13d0b6e 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -1275,15 +1275,21 @@ int _set_media_format(webrtc_s *webrtc, unsigned int source_id, media_format_h f ret = __complete_mediapacketsrc_from_raw_format(webrtc, source); else ret = __complete_mediapacketsrc_from_encoded_format(webrtc, source); - if (ret != WEBRTC_ERROR_NONE) { LOG_ERROR("failed to complete mediapacketsrc"); - media_format_unref(format); - source->media_format = NULL; - return ret; + goto error; } - return __link_source_with_webrtcbin(source, webrtc->gst.webrtcbin); + ret = __link_source_with_webrtcbin(source, webrtc->gst.webrtcbin); + if (ret != WEBRTC_ERROR_NONE) + goto error; + + return ret; + +error: + media_format_unref(format); + source->media_format = NULL; + return ret; } static gboolean __check_format_is_not_set_cb(gpointer key, gpointer value, gpointer user_data) -- 2.34.1