• Andreas Rheinhardt's avatar
    avformat/matroskadec: Move AVBufferRef instead of copying, fix memleak · 751f2851
    Andreas Rheinhardt authored
    EBML binary elements are already made reference-counted when read;
    so when populating the AVStream.attached_pic, one does not need to
    allocate a new buffer for the data; instead the current code just
    creates a new reference to the underlying AVBuffer. But this can be
    improved even further: Just move the already existing reference.
    
    This also fixes a memleak that happens upon error because
    matroska_read_close has not been called in this scenario.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    (cherry picked from commit cbe336c9e81e2d9de3a18abef887c9255a9b9da5)
    751f2851
matroskadec.c 159 KB