mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
freedreno: Fix file descriptor leak.
Fix defect reported by Coverity Scan.
Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.
Fixes: 5a13507164 ("freedreno/perfcntrs: add fdperf")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9889>
This commit is contained in:
parent
ee14bec09a
commit
a5d5cbdf08
1 changed files with 2 additions and 3 deletions
|
|
@ -246,10 +246,9 @@ fd_dt_find_io(void)
|
|||
return NULL;
|
||||
|
||||
void *io = mmap(0, dev.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, dev.base);
|
||||
if (io == MAP_FAILED) {
|
||||
close(fd);
|
||||
close(fd);
|
||||
if (io == MAP_FAILED)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return io;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue