dcaenc: fix segfault when attempting to encode with invalid samplerate

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
Rostislav Pehlivanov 2018-05-05 18:42:53 +01:00
parent a1c6fc773f
commit c1b282dc74
1 changed files with 5 additions and 2 deletions

View File

@ -152,8 +152,11 @@ static int subband_bufer_alloc(DCAEncContext *c)
static void subband_bufer_free(DCAEncContext *c) static void subband_bufer_free(DCAEncContext *c)
{ {
int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS; if (c->subband[0][0]) {
av_freep(&bufer); int32_t *bufer = c->subband[0][0] - DCA_ADPCM_COEFFS;
av_free(bufer);
c->subband[0][0] = NULL;
}
} }
static int encode_init(AVCodecContext *avctx) static int encode_init(AVCodecContext *avctx)