8svx: fix memleak in iff-fibonacci fate test.

pull/3/head
Clément Bœsch 13 years ago
parent e3127db438
commit f2193569a5
  1. 4
      libavcodec/8svx.c

@ -110,7 +110,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
/* decode and interleave the first packet */ /* decode and interleave the first packet */
if (!esc->samples && avpkt) { if (!esc->samples && avpkt) {
uint8_t *deinterleaved_samples; uint8_t *deinterleaved_samples, *p = NULL;
esc->samples_size = avctx->codec->id == CODEC_ID_8SVX_RAW || avctx->codec->id ==CODEC_ID_PCM_S8_PLANAR? esc->samples_size = avctx->codec->id == CODEC_ID_8SVX_RAW || avctx->codec->id ==CODEC_ID_PCM_S8_PLANAR?
avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2; avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2;
@ -129,6 +129,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
} }
if (!(deinterleaved_samples = av_mallocz(n))) if (!(deinterleaved_samples = av_mallocz(n)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
p = deinterleaved_samples;
/* the uncompressed starting value is contained in the first byte */ /* the uncompressed starting value is contained in the first byte */
if (avctx->channels == 2) { if (avctx->channels == 2) {
@ -145,6 +146,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size); interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size);
else else
memcpy(esc->samples, deinterleaved_samples, esc->samples_size); memcpy(esc->samples, deinterleaved_samples, esc->samples_size);
av_freep(&p);
} }
/* get output buffer */ /* get output buffer */

Loading…
Cancel
Save