Commit 669d3f00 authored by Michael Smith's avatar Michael Smith

Fix memleak in raw mode

svn path=/trunk/vorbis-tools/; revision=10092
parent 31abf7f6
......@@ -596,7 +596,7 @@ void wav_close(void *info)
free(f);
}
int raw_open(FILE *in, oe_enc_opt *opt)
int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
{
wav_fmt format; /* fake wave header ;) */
wavfile *wav = malloc(sizeof(wavfile));
......@@ -763,6 +763,7 @@ static long read_downmix(void *data, float **buffer, int samples)
for(i=0; i < in_samples; i++) {
buffer[0][i] = (d->bufs[0][i] + d->bufs[1][i])*0.5f;
fprintf(stderr, "%f %f -> %f\n", d->bufs[0][i] , d->bufs[1][i], buffer[0][i]);
}
return in_samples;
......
......@@ -54,7 +54,7 @@ typedef wavfile aifffile; /* They're the same */
input_format *open_audio_file(FILE *in, oe_enc_opt *opt);
int raw_open(FILE *in, oe_enc_opt *opt);
int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
int wav_id(unsigned char *buf, int len);
......
......@@ -192,11 +192,16 @@ int main(int argc, char **argv)
if(opt.rawmode)
{
input_format raw_format = {NULL, 0, raw_open, wav_close, "raw",
N_("RAW file reader")};
enc_opts.rate=opt.raw_samplerate;
enc_opts.channels=opt.raw_channels;
enc_opts.samplesize=opt.raw_samplesize;
enc_opts.endianness=opt.raw_endianness;
raw_open(in, &enc_opts);
format = &raw_format;
format->open_func(in, &enc_opts, NULL, 0);
foundformat=1;
}
else
......@@ -366,8 +371,7 @@ clear_all:
if(out_fn) free(out_fn);
if(opt.outfile) free(opt.outfile);
vorbis_comment_clear(&vc);
if(!opt.rawmode)
format->close_func(enc_opts.readdata);
format->close_func(enc_opts.readdata);
if(closein)
fclose(in);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment