linux/ofpath: fix descriptor leak

Found by: Coverity scan
This commit is contained in:
Andrei Borzenkov 2015-01-27 20:29:00 +03:00
parent 7ba137f628
commit 637fc62699
1 changed files with 2 additions and 0 deletions

View File

@ -122,6 +122,8 @@ find_obppath (const char *sysfs_path_orig)
fd = open(path, O_RDONLY);
if (fd < 0 || fstat (fd, &st) < 0)
{
if (fd >= 0)
close (fd);
snprintf(path, path_size, "%s/devspec", sysfs_path);
fd = open(path, O_RDONLY);
}