webrtc_source: Add missing unref call of the media format when an error occurs 92/253092/4
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 4 Feb 2021 09:47:39 +0000 (18:47 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 8 Feb 2021 10:20:25 +0000 (19:20 +0900)
[Version] 0.1.108
[Issue Type] Bug fix

Change-Id: I79fcbe483146e4463196588e30a27af6231afd0a
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_source.c

index 89ee6aa45a5f13188ce0a0c25a8b7243d97e595a..4e89fa91622f17321da90da4378d0669c0cfff7c 100644 (file)
@@ -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
index b89851e3528b6c348bc8d3a5e20bcf72ae04c8f9..c13d0b6e888633072698237724b48f22dbaa8956 100644 (file)
@@ -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)