]> git.tuebingen.mpg.de Git - paraslash.git/commit
afh: Fix fd leak.
authorAndre Noll <maan@systemlinux.org>
Sun, 15 Dec 2013 21:39:21 +0000 (22:39 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 15 Jan 2015 20:57:28 +0000 (21:57 +0100)
commitbba6e3e012e9b51d738b83b363dbcebc731643cb
treef89c2b069f98422cf1b6806988ee558c4d29d385
parent6761a4b76e3e7534ead2021cee9bab41716d4488
afh: Fix fd leak.

The main() function of para_afh obtains the open file descriptor from
mmap_full_file() which is then passed to compute_afhi(). If this file
descriptor is never closed, we have an fd leak.

Unfortunately it depends on the audio format handler whether fd
gets closed or not: the mp3 audio format handler closes it through
libid3tag's id3_file_close() while all other audio format handlers
leave it open.

Fix this by changing mp3_get_id3() to operate on a copy of the fd
instead so that the original fd remains open. The newly added close()
in afh.c thus fixes the fd leak and never closes an invalid fd.
afh.c
mp3_afh.c