Commit 83330cf5 authored by Michael Niedermayer's avatar Michael Niedermayer

init_vlc_sparse: fix leak on error

Fixes CID1005312
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 0c77cdb4
...@@ -307,11 +307,13 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, ...@@ -307,11 +307,13 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
continue;\ continue;\
if (buf[j].bits > 3*nb_bits || buf[j].bits>32) {\ if (buf[j].bits > 3*nb_bits || buf[j].bits>32) {\
av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\ av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\
av_free(buf);\
return -1;\ return -1;\
}\ }\
GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\ GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\
if (buf[j].code >= (1LL<<buf[j].bits)) {\ if (buf[j].code >= (1LL<<buf[j].bits)) {\
av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\ av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\
av_free(buf);\
return -1;\ return -1;\
}\ }\
if (flags & INIT_VLC_LE)\ if (flags & INIT_VLC_LE)\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment