Fix SVACE defect 85/255985/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Fri, 26 Mar 2021 04:12:49 +0000 (13:12 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 26 Mar 2021 04:13:17 +0000 (13:13 +0900)
- DEREF_OF_NULL.RET.ALLOC
- PASS_TO_PROC_AFTER_CHECK
- INVARIANT_RESULT.OP_ZERO
- NO_EFFECT
- UNREACHABLE_CODE

[Version] 0.1.132
[Issue Type] Svace

Change-Id: I48afb8b4a5842c3976d57fa190542a04e2b20935

packaging/capi-media-webrtc.spec
src/webrtc_sink.c
test/webrtc_test.c

index 17b3e95299c2706f1f26f5cab13e72001e6209b0..ac3235ecb28d1bbd020cf230a5cf7c51438d2761 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.131
+Version:    0.1.132
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index dbaee98ca4305a5ababcde7ca1c3ec18bcc5940e..10ac5bd64c910617da19505130a42ad959597e1e 100644 (file)
@@ -442,7 +442,7 @@ int _add_rendering_sink_bin(webrtc_s *webrtc, GstPad *src_pad)
        gchar *track_name;
        webrtc_gst_slot_s *sink;
        GstElement *decodebin;
-       GstPad *sink_pad;
+       GstPad *sink_pad = NULL;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(src_pad == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "src_pad is NULL");
@@ -500,7 +500,8 @@ int _add_rendering_sink_bin(webrtc_s *webrtc, GstPad *src_pad)
        return WEBRTC_ERROR_NONE;
 
 error_before_insert:
-       gst_object_unref(sink_pad);
+       if (sink_pad)
+               gst_object_unref(sink_pad);
        g_free(track_name);
        g_free(sink);
 
index f2929565f668da62dcd87f51f5a0f4b220576549..80d92655cde30fc301ef97ad43fd1f372f6bfb4c 100644 (file)
@@ -334,7 +334,7 @@ static void __release_packet_source(int conn_idx, unsigned int source_idx)
 {
        if (conn_idx < 0 || conn_idx >= MAX_CONNECTION_LEN)
                return;
-       if (source_idx < 0 || source_idx >= MAX_MEDIA_PACKET_SOURCE_LEN)
+       if (source_idx >= MAX_MEDIA_PACKET_SOURCE_LEN)
                return;
 
        media_packet_source_s *packet_source = &g_conns[conn_idx].packet_sources[source_idx];
@@ -796,7 +796,7 @@ static void _webrtc_set_stun_server(int index, char *uri)
        if (!uri)
                return;
 
-       webrtc_set_stun_server(g_conns[index].webrtc, uri);
+       ret = webrtc_set_stun_server(g_conns[index].webrtc, uri);
        if (ret != WEBRTC_ERROR_NONE)
                g_print("failed to webrtc_set_stun_server(), uri[%s], ret[0x%x]\n", uri, ret);
        else
@@ -853,7 +853,8 @@ static void __file_dump(const gchar *file_name, void *src_buffer, int size)
 
 end:
        g_free(full_path);
-       close(fd);
+       if (fd != -1)
+               close(fd);
 }
 
 static void __data_channel_message_cb(webrtc_data_channel_h channel, webrtc_data_channel_type_e type, void *message, void *user_data)