webrtc_test: Fix crash by adding null checking code 34/251234/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 11 Jan 2021 23:14:04 +0000 (08:14 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 18 Jan 2021 03:33:43 +0000 (12:33 +0900)
It happended when the stun_server is NULL.

[Version] 0.1.80
[Issue Type] Bug fix

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

index 72b1baab247d05f9e18d81ff315104ab216d4917..14ce3d42551c7df3cc52193268b48e92dbf972f6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.79
+Version:    0.1.80
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 799052d8865462a8c19a89d31f22152dd65a93d9..b8139cf8083e975af4212cddd0f2b6051f75e111 100644 (file)
@@ -2095,7 +2095,7 @@ void display_handle_status(int index)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_state_e state;
-       char *stun_server;
+       char *stun_server = NULL;
 
        if (g_conns[index].webrtc == NULL)
                return;
@@ -2110,10 +2110,10 @@ void display_handle_status(int index)
 
        g_print("  webrtc[%p]", g_conns[index].webrtc);
        g_print("  state[%s]", g_webrtc_state_str[state]);
-       if (strlen(stun_server) > 0)
+       if (stun_server) {
                g_print("  STUN server[%s]", stun_server);
-
-       free(stun_server);
+               free(stun_server);
+       }
 
        g_print("\n-----------------------------------------------------------------------------------------\n");
 }