Skip to content

Commit

Permalink
Fix mem-leak in GetAVMediaFileProp
Browse files Browse the repository at this point in the history
  • Loading branch information
bear101 committed Nov 3, 2024
1 parent a936aa5 commit b9622a0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Library/TeamTalkLib/avstream/FFmpegStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ bool GetAVMediaFileProp(const ACE_TString& filename, MediaFileProp& out_prop)
out_prop.filename = filename;

if (aud_dec_ctx)
avcodec_close(aud_dec_ctx);
avcodec_free_context(&aud_dec_ctx);

if(vid_dec_ctx)
avcodec_close(vid_dec_ctx);
if (vid_dec_ctx)
avcodec_free_context(&vid_dec_ctx);

avformat_close_input(&fmt_ctx);

Expand Down Expand Up @@ -578,15 +578,14 @@ void FFmpegStreamer::Run()
m_statuscallback(m_media_in, MEDIASTREAM_ERROR);

end:
if(audio_filter_graph)
if (audio_filter_graph)
avfilter_graph_free(&audio_filter_graph);
avcodec_close(aud_dec_ctx);
if(video_filter_graph)
if (aud_dec_ctx)
avcodec_free_context(&aud_dec_ctx);
if (video_filter_graph)
avfilter_graph_free(&video_filter_graph);
if (vid_dec_ctx)
avcodec_free_context(&vid_dec_ctx);
// if(options)
// av_dict_free(&options); //causes crash...
if(fmt_ctx)
avformat_close_input(&fmt_ctx);
av_frame_free(&aud_frame);
Expand Down

0 comments on commit b9622a0

Please sign in to comment.