[ITC][webrtc][non-ACR] Fix redundant unreffing media packet 72/316272/2
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 19 Aug 2024 01:01:30 +0000 (10:01 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 19 Aug 2024 04:36:44 +0000 (13:36 +0900)
Fix heap-use-after-free on ASAN image.

Change-Id: Ib9935b3f7d256d3955a521bf19f6c72dce52a21d
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
src/itc/webrtc/ITs-webrtc.c

index ab9d1200934a17f98087f73eba92663688d3a286..3486833787aa23fa200e73ce8159a31fa5df7dc3 100755 (executable)
@@ -969,12 +969,10 @@ int ITc_webrtc_media_packet_source_push_packet_p(void)
        nRet = media_packet_new_alloc(hMediaFormat, NULL, NULL, &hMediaPacket);
        PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_packet_new_alloc", WebRtcGetError(nRet),media_format_unref(hMediaFormat));
 
+       /* NOTE: the function below takes ownership of the packet.(no need to unref the packet, or make sure to ref/unref pair). */
        nRet = webrtc_media_packet_source_push_packet(g_hWebRtcHandle, nId, hMediaPacket);
        PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_push_packet", WebRtcGetError(nRet),media_packet_unref(hMediaPacket);media_format_unref(hMediaFormat));
 
-       nRet = media_packet_unref(hMediaPacket);
-       PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_packet_unref", WebRtcGetError(nRet));
-
        nRet = media_format_unref(hMediaFormat);
        PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_format_unref", WebRtcGetError(nRet));