SDL_kmsdrmmouse.c uses KMSDRM_gbm_device_get_fd() in two functions. The handle is not closed in any of those 2 places. This causes handle leak at least on some platforms.
Does anybody know - is KMSDRM_gbm_device_get_fd() supposed to return a new handle (e.g. duplicate of the existing handle) that needs to be closed? Or is it supposed to return the existing handle?
Thank you! I have found this source code, however at least in some platforms subsequent calls to KMSDRM_gbm_device_get_fd() return different handle values.
I have built release-2.0.16 with this patch and obtained this output in the log when running the application:
ERROR: DEBUG2 Handle is 30
ERROR: DEBUG2 Handle is 31
ERROR: DEBUG2 Handle is 32
ERROR: DEBUG2 Handle is 32
ERROR: DEBUG2 Handle is 33
ERROR: DEBUG2 Handle is 34
P.S. The application is EmulationStation running on Batocera Linux on ODROID-GO Advance Black Edition game console.
That’s weird - maybe you (or your version of SDL, libgbm or whatever) have some sort of memory corruption that overrides that value? You could try breaking in a debugger after the first print and add a data watchpoint on gbm->fd (or gbm->v0.fd) and see what changes it.