diff options
author | XANTRONIX Development | 2022-02-01 14:27:52 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-02-01 14:27:52 -0500 |
commit | 2c1fae9184f6fc55e5f55be331c67990d6a1bde1 (patch) | |
tree | 0610e0360a0ea940e906d4f82558ce64c8fbd197 /src | |
parent | f20a98aa7a2f418167d884df4da243986ba601ec (diff) | |
download | xas-2c1fae9184f6fc55e5f55be331c67990d6a1bde1.tar.gz xas-2c1fae9184f6fc55e5f55be331c67990d6a1bde1.tar.bz2 xas-2c1fae9184f6fc55e5f55be331c67990d6a1bde1.zip |
Ensure close_file() callback always free()s data
Diffstat (limited to 'src')
-rw-r--r-- | src/riff.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -284,21 +284,15 @@ error_malloc_riff: } static void close_file(xas_riff *riff, xas_audio_stream *stream) { - if (lseek(riff->fd, 0, SEEK_SET) < 0) { - goto error_io; + if (lseek(riff->fd, 0, SEEK_SET) == 0) { + (void)header_write(riff); } - if (header_write(riff) < 0) { - goto error_header_write; + if (riff->file) { + (void)close(riff->fd); } - (void)close(riff->fd); - free(riff); - -error_header_write: -error_io: - return; } static ssize_t audio_drain(xas_riff *riff, |