ref: 0a6c4700a5c5df2145f28c384c91927a90126622
parent: b70c4a189ba5d201f33d4c0105e0ed8bd73a4171
author: Gregory Maxwell <[email protected]>
date: Wed Jun 13 09:40:16 EDT 2012
Avoid an inconsequential memory leak in opusenc reported by scan-build.
--- a/Makefile.unix
+++ b/Makefile.unix
@@ -2,7 +2,7 @@
#Run ./configure to run autotools/autoconf.
#This makefile exists as a fallback where autotools isn't working.
#CC=gcc
-CFLAGS:=-DPACKAGE='"opus-tools"' -DVERSION='"0.1.2"' -DOPUSTOOLS -O2 -g -c -Wall -Wextra -DHAVE_GETOPT_H -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT $(CFLAGS)
+CFLAGS:=-DPACKAGE='"opus-tools"' -DVERSION='"0.1.2git"' -DOPUSTOOLS -O2 -g -c -Wall -Wextra -DHAVE_GETOPT_H -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT $(CFLAGS)
INCLUDES=-I../opus/include
all: opusenc opusdec opusinfo
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@
OPUSTOOLS_MAJOR_VERSION=0
OPUSTOOLS_MINOR_VERSION=1
OPUSTOOLS_MICRO_VERSION=2
-OPUSTOOLS_EXTRA_VERSION=
+OPUSTOOLS_EXTRA_VERSION=git
OPUSTOOLS_VERSION="$OPUSTOOLS_MAJOR_VERSION.$OPUSTOOLS_MINOR_VERSION.$OPUSTOOLS_MICRO_VERSION$OPUSTOOLS_EXTRA_VERSION"
AC_MSG_CHECKING([git revision])
--- a/src/audio-in.c
+++ b/src/audio-in.c
@@ -447,7 +447,7 @@
unsigned int len;
int samplesize;
wav_fmt format;
- wavfile *wav = malloc(sizeof(wavfile));
+ wavfile *wav;
int i;
(void)buflen;/*unused*/
(void)oldbuf;/*unused*/
@@ -579,6 +579,7 @@
opt->rate = format.samplerate;
opt->channels = format.channels;
+ wav = malloc(sizeof(wavfile));
wav->f = in;
wav->samplesread = 0;
wav->bigendian = 0;
@@ -986,7 +987,7 @@
downmix *d = calloc(1, sizeof(downmix));
int i,j;
- if(opt->channels<=out_channels || out_channels>2 || (out_channels==2&&opt->channels>8)) {
+ if(opt->channels<=out_channels || out_channels>2 || (out_channels==2&&opt->channels>8) || opt->channels<=0 || out_channels<=0) {
fprintf(stderr, "Downmix must actually downmix and only knows mono/stereo out.\n");
if(opt->channels>8)fprintf(stderr, "Downmix also only knows how to mix >8ch to mono.\n");
return 0;