CoverityID:
1110568,
1458071
Fixes: 5a13507164a26fc796f0 ("freedreno/perfcntrs: add fdperf")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3671>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3671>
if (ret < 0) {
free(buf);
*sz = 0;
+ close(fd);
return NULL;
} else if (ret < CHUNKSIZE) {
n += ret;
*sz = n;
+ close(fd);
return buf;
} else {
n += CHUNKSIZE;
err(1, "could not open /dev/mem");
dev.io = mmap(0, dev.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, dev.base);
- if (!dev.io)
+ if (!dev.io) {
+ close(fd);
err(1, "could not map device");
+ }
}
/*