Mercurial > mplayer.hg
comparison libmpdemux/demux_mkv.c @ 32225:8ebdc8466b2f
Check for realloc failure. Ignore the memleak this causes since
the mkv demuxer is not properly maintained anymore anyway.
author | reimar |
---|---|
date | Sat, 18 Sep 2010 17:40:14 +0000 |
parents | 23ba595c0292 |
children | 69d3be4d52a2 |
comparison
equal
deleted
inserted
replaced
32224:23ba595c0292 | 32225:8ebdc8466b2f |
---|---|
321 if (*size > SIZE_MAX - 4000 - AV_LZO_INPUT_PADDING) | 321 if (*size > SIZE_MAX - 4000 - AV_LZO_INPUT_PADDING) |
322 goto zlib_fail; | 322 goto zlib_fail; |
323 | 323 |
324 *size += 4000; | 324 *size += 4000; |
325 *dest = realloc(*dest, *size + AV_LZO_INPUT_PADDING); | 325 *dest = realloc(*dest, *size + AV_LZO_INPUT_PADDING); |
326 if (!*dest) | |
327 goto zlib_fail; | |
326 zstream.next_out = (Bytef *) (*dest + zstream.total_out); | 328 zstream.next_out = (Bytef *) (*dest + zstream.total_out); |
327 result = inflate(&zstream, Z_NO_FLUSH); | 329 result = inflate(&zstream, Z_NO_FLUSH); |
328 if (result != Z_OK && result != Z_STREAM_END) { | 330 if (result != Z_OK && result != Z_STREAM_END) { |
329 zlib_fail: | 331 zlib_fail: |
330 mp_msg(MSGT_DEMUX, MSGL_WARN, | 332 mp_msg(MSGT_DEMUX, MSGL_WARN, |
354 int padding = FFMAX(AV_LZO_OUTPUT_PADDING, AV_LZO_INPUT_PADDING); | 356 int padding = FFMAX(AV_LZO_OUTPUT_PADDING, AV_LZO_INPUT_PADDING); |
355 int srclen = *size; | 357 int srclen = *size; |
356 if (dstlen > SIZE_MAX - padding) | 358 if (dstlen > SIZE_MAX - padding) |
357 goto lzo_fail; | 359 goto lzo_fail; |
358 *dest = realloc(*dest, dstlen + padding); | 360 *dest = realloc(*dest, dstlen + padding); |
361 if (!*dest) | |
362 goto lzo_fail; | |
359 out_avail = dstlen; | 363 out_avail = dstlen; |
360 result = av_lzo1x_decode(*dest, &out_avail, src, &srclen); | 364 result = av_lzo1x_decode(*dest, &out_avail, src, &srclen); |
361 if (result == 0) | 365 if (result == 0) |
362 break; | 366 break; |
363 if (!(result & AV_LZO_OUTPUT_FULL)) { | 367 if (!(result & AV_LZO_OUTPUT_FULL)) { |