sad

simple audio daemon
git clone git://git.2f30.org/sad
Log | Files | Refs | LICENSE

commit 0fe91cde15bfd54b0f866639a41ab806eb3c48cf
parent d5612adbde3a391153f2c85ea71ccf9e2660d819
Author: sin <sin@2f30.org>
Date:   Fri, 26 Dec 2014 17:52:57 +0000

fclose if vorbis open fails

Diffstat:
Mvorbis.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/vorbis.c b/vorbis.c @@ -34,22 +34,26 @@ vorbisopen(const char *name) r = ov_open_callbacks(fp, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE); if (r < 0) { warnx("ov_open_callbacks: failed"); - return -1; + goto err0; } vi = ov_info(&vf, -1); if (!vi) { warnx("ov_info: failed"); - goto err0; + goto err1; } r = output->open(16, vi->rate, vi->channels); if (r < 0) - goto err0; + goto err1; return 0; -err0: + +err1: ov_clear(&vf); +err0: + fclose(fp); + fp = NULL; return -1; }