Fix resource leaks and division by zero 84/279784/3 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_7.0 tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.063737 accepted/tizen/7.0/unified/hotfix/20221116.104727 accepted/tizen/unified/20220819.122409 submit/tizen/20220819.013019 tizen_7.0_m2_release
authorjiyong.min <jiyong.min@samsung.com>
Wed, 17 Aug 2022 23:09:55 +0000 (08:09 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Thu, 18 Aug 2022 01:58:20 +0000 (10:58 +0900)
[Version] 0.1.148
[IssueType] Bug fix

Change-Id: I00fe8bd7cf1f510b1151c008295237fd54b74b54

packaging/capi-media-streamer.spec
src/media_streamer_gst.c
src/media_streamer_gst_webrtc.c

index 402c070..00882ca 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamer
 Summary:    A Media Streamer API
-Version:    0.1.147
+Version:    0.1.148
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 72770cc..ddb5872 100644 (file)
@@ -2564,7 +2564,7 @@ static media_format_h __ms_create_fmt_from_caps(GstCaps *caps)
        int width = 0;
        int height = 0;
        int fps_n = 0;
-       int fps_d = 0;
+       int fps_d = 1;
 
        ms_debug_fenter();
 
@@ -2593,6 +2593,12 @@ static media_format_h __ms_create_fmt_from_caps(GstCaps *caps)
                gst_structure_get_int(pad_struct, "height", &height);
                gst_structure_get_fraction(pad_struct, "framerate", &fps_n, &fps_d);
 
+               if (fps_d == 0) {
+                       ms_error("fps_d is 0");
+                       media_format_unref(fmt);
+                       return NULL;
+               }
+
                media_format_set_video_mime(fmt, ms_convert_video_string_format_to_media_format(pad_format));
                media_format_set_video_width(fmt, width);
                media_format_set_video_height(fmt, height);
index 974b235..7cecb90 100644 (file)
@@ -310,6 +310,7 @@ int ms_webrtcbin_set_remote_session_description(media_streamer_node_s *webrtc_no
        ret = gst_sdp_message_parse_buffer((guint8 *)sdp, strlen(sdp), gst_sdp);
        if (ret != GST_SDP_OK) {
                ret = MEDIA_STREAMER_ERROR_INVALID_OPERATION;
+               gst_sdp_message_free(gst_sdp);
                goto end;
        }
 
@@ -329,6 +330,7 @@ int ms_webrtcbin_set_remote_session_description(media_streamer_node_s *webrtc_no
                ms_webrtcbin_on_negotiation_process_answer(webrtcbin, webrtc_node);
        } else {
                ms_error("type is %s, it is not a answer or offer", type);
+               gst_sdp_message_free(gst_sdp);
        }
 
 end: