From e082c2c3dfced1cd20d7c1cb7ee7a661dffc8686 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 21 Nov 2014 09:58:09 +0100 Subject: Remove some unneeded NULL checks Found by Coverity; also see commit 85fb2af3. --- audio/filter/af_export.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'audio') diff --git a/audio/filter/af_export.c b/audio/filter/af_export.c index 9c3bab671a..d867bc4a94 100644 --- a/audio/filter/af_export.c +++ b/audio/filter/af_export.c @@ -78,8 +78,7 @@ static int control(struct af_instance* af, int cmd, void* arg) int mapsize; // Free previous buffers - if (s->buf) - free(s->buf[0]); + free(s->buf[0]); // unmap previous area if(s->mmap_area) @@ -94,8 +93,10 @@ static int control(struct af_instance* af, int cmd, void* arg) // Allocate new buffers (as one continuous block) s->buf[0] = calloc(s->sz*af->data->nch, af->data->bps); - if(NULL == s->buf[0]) + if(NULL == s->buf[0]) { MP_FATAL(af, "Out of memory\n"); + return AF_ERROR; + } for(i = 1; i < af->data->nch; i++) s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps; @@ -147,8 +148,8 @@ static int control(struct af_instance* af, int cmd, void* arg) static void uninit( struct af_instance* af ) { af_export_t* s = af->priv; - if (s->buf) - free(s->buf[0]); + + free(s->buf[0]); // Free mmaped area if(s->mmap_area) -- cgit v1.2.3