]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bgmc.c
avcodec: Remove redundant freeing of extradata of encoders
[ffmpeg] / libavcodec / bgmc.c
index 1a6817b73f7b3fb895c40d9a24a3902f0513fcc2..361f7c52e627161b92529e9209de9ef9620775c4 100644 (file)
@@ -485,12 +485,17 @@ av_cold void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
 
 
 /** Initialize decoding and reads the first value */
-void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
+int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
                          unsigned int *l, unsigned int *v)
 {
+    if (get_bits_left(gb) < VALUE_BITS)
+        return AVERROR_INVALIDDATA;
+
     *h = TOP_VALUE;
     *l = 0;
-    *v = get_bits_long(gb, VALUE_BITS);
+    *v = get_bits(gb, VALUE_BITS);
+
+    return 0;
 }