linux/ofpath: fix descriptor leak
Found by: Coverity scan
This commit is contained in:
parent
7ba137f628
commit
637fc62699
1 changed files with 2 additions and 0 deletions
|
@ -122,6 +122,8 @@ find_obppath (const char *sysfs_path_orig)
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd < 0 || fstat (fd, &st) < 0)
|
if (fd < 0 || fstat (fd, &st) < 0)
|
||||||
{
|
{
|
||||||
|
if (fd >= 0)
|
||||||
|
close (fd);
|
||||||
snprintf(path, path_size, "%s/devspec", sysfs_path);
|
snprintf(path, path_size, "%s/devspec", sysfs_path);
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue