avcodec/flac_parser: Check for av_malloc() failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/101/merge
Michael Niedermayer 10 years ago
parent 5f964c6027
commit 6c3cb02a74
  1. 5
      libavcodec/flac_parser.c

@ -192,6 +192,11 @@ static int find_headers_search_validate(FLACParseContext *fpc, int offset)
(*end_handle)->offset = offset;
(*end_handle)->link_penalty = av_malloc(sizeof(int) *
FLAC_MAX_SEQUENTIAL_HEADERS);
if (!(*end_handle)->link_penalty) {
av_freep(end_handle);
return AVERROR(ENOMEM);
}
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
(*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;

Loading…
Cancel
Save