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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user