From: Jens Axboe Date: Fri, 11 Apr 2014 17:31:17 +0000 (-0600) Subject: Fix leak of directory handle in find_add_disk_slaves() error case X-Git-Tag: fio-2.1.9~72 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=f0cc675fd0a5902f3637a91024082d2d24a665a7;ds=inline Fix leak of directory handle in find_add_disk_slaves() error case Signed-off-by: Jens Axboe --- diff --git a/diskutil.c b/diskutil.c index cbde42e9..5170915c 100644 --- a/diskutil.c +++ b/diskutil.c @@ -239,6 +239,7 @@ static void find_add_disk_slaves(struct thread_data *td, char *path, linklen = readlink(temppath, slavepath, PATH_MAX - 1); if (linklen < 0) { perror("readlink() for slave device."); + closedir(dirhandle); return; } slavepath[linklen] = '\0'; @@ -246,6 +247,7 @@ static void find_add_disk_slaves(struct thread_data *td, char *path, sprintf(temppath, "%s/%s/dev", slavesdir, slavepath); if (read_block_dev_entry(temppath, &majdev, &mindev)) { perror("Error getting slave device numbers."); + closedir(dirhandle); return; }