From: Sangchul Lee Date: Mon, 19 Aug 2024 02:08:52 +0000 (+0900) Subject: webrtc_data_channel: Fix use-after-free issue X-Git-Tag: accepted/tizen/8.0/unified/20240827.162859~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31c6646713b08bb7011e65f41bde6abe1df12248;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_data_channel: Fix use-after-free issue (cherry-picked from tizen branch) [Version] 0.4.60 [Issue Type] ASAN defect Change-Id: Idae9729c00520ca6aa55655fb795c0c9175ed6c0 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index cc4c9f70..3fe0f2cb 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.4.59 +Version: 0.4.60 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_data_channel.c b/src/webrtc_data_channel.c index 52407328..a14b5ded 100644 --- a/src/webrtc_data_channel.c +++ b/src/webrtc_data_channel.c @@ -247,9 +247,9 @@ int _destroy_data_channel(webrtc_data_channel_s *channel) RET_VAL_IF(channel == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "channel is NULL"); RET_VAL_IF(channel->from_remote, WEBRTC_ERROR_INVALID_PARAMETER, "do not destroy a data channel obtained from _on_data_channel_cb()"); - g_hash_table_remove(channel->webrtc->data_channels, channel); + LOG_INFO("data channel[%p, object:%p] will be destroyed", channel, channel->channel); - LOG_INFO("data channel[%p, object:%p] is destroyed", channel, channel->channel); + g_hash_table_remove(channel->webrtc->data_channels, channel); return WEBRTC_ERROR_NONE; }