In decode_plane() and decode_plane10(), both of these two functions use
build_buff() which allocates memory in vlc and multi. And both of them
forget to release vlc and multi when build_buff report a symbol to fill
slices with. Add cleanup label and goto cleanup first before return 0.

Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn>
---
 libavcodec/utvideodec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 4c0fa2ca67..f15d623462 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -179,7 +179,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
                 dest += stride;
             }
         }
-        return 0;
+        goto cleanup;
     }
 
     send = 0;
@@ -216,6 +216,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
                    "%d bits left after decoding slice\n", get_bits_left(&gb));
     }
 
+cleanup:
     ff_vlc_free(&vlc);
     ff_vlc_free_multi(&multi);
 
@@ -322,7 +323,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
                 dest += stride;
             }
         }
-        return 0;
+        goto cleanup;
     }
 
     src      += 256;
@@ -361,6 +362,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
                    "%d bits left after decoding slice\n", get_bits_left(&gb));
     }
 
+cleanup:
     ff_vlc_free(&vlc);
     ff_vlc_free_multi(&multi);
 
-- 
2.50.0.106.gf0135a9047.dirty

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to