提交 d16575d2 authored 作者: Mike Jerris's avatar Mike Jerris

FS-11962: [core] Fix memory leak in switch_core_session_write_video_frame

上级 200a76b2
...@@ -14545,6 +14545,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor ...@@ -14545,6 +14545,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
switch_status_t encode_status; switch_status_t encode_status;
switch_frame_t write_frame = {0}; switch_frame_t write_frame = {0};
switch_rtp_engine_t *v_engine = NULL; switch_rtp_engine_t *v_engine = NULL;
switch_bool_t need_free = SWITCH_FALSE;
switch_assert(session); switch_assert(session);
if (!(smh = session->media_handle)) { if (!(smh = session->media_handle)) {
...@@ -14679,6 +14680,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor ...@@ -14679,6 +14680,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
bp->video_ping_frame = NULL; bp->video_ping_frame = NULL;
} }
if (bug_frame.img && bug_frame.img != img) {
need_free = SWITCH_TRUE;
img = bug_frame.img;
}
if (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM_BLEG) && !patched) { if (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM_BLEG) && !patched) {
switch_core_media_bug_patch_spy_frame(bp, img, SWITCH_RW_WRITE); switch_core_media_bug_patch_spy_frame(bp, img, SWITCH_RW_WRITE);
} }
...@@ -14751,6 +14757,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor ...@@ -14751,6 +14757,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
switch_img_free(&dup_img); switch_img_free(&dup_img);
if (need_free) {
switch_img_free(&frame->img);
}
return status; return status;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论