Ticket #5152: programs_mythtranscode_mpeg2fix.cpp-fix-mem-leak.patch

File programs_mythtranscode_mpeg2fix.cpp-fix-mem-leak.patch, 941 bytes (added by Erik Hovland <erik@…>, 12 years ago)

free the frame in error paths

  • programs/mythtranscode/mpeg2fix.cpp

    A frame is allocated by MPEG2fixup::BuildFrame. It doesn't dealloc
    
    From: Erik Hovland <erik@hovland.org>
    
    when it can't find an MPEG encoder to work with the frame. It should.
    ---
    
     programs/mythtranscode/mpeg2fix.cpp |    2 ++
     1 files changed, 2 insertions(+), 0 deletions(-)
    
    diff --git a/programs/mythtranscode/mpeg2fix.cpp b/programs/mythtranscode/mpeg2fix.cpp
    index 3df1865..56b8845 100644
    a b int MPEG2fixup::BuildFrame(AVPacket *pkt, QString fname) 
    10551055
    10561056    if (! out_codec)
    10571057    {
     1058        free(picture);
    10581059        VERBOSE(MPF_IMPORTANT, "Couldn't find MPEC2 encoder");
    10591060        return 1;
    10601061    }
    int MPEG2fixup::BuildFrame(AVPacket *pkt, QString fname) 
    11021103
    11031104    if (avcodec_open(c, out_codec) < 0)
    11041105    {
     1106        free(picture);
    11051107        VERBOSE(MPF_IMPORTANT, "could not open codec");
    11061108        return 1;
    11071109    }