In the if-statement this return error no. is returned without closing "nvdev". Yet in the next if-statement "nvdev" is closed! This must cause a memory leak if the first path is followed? Because even if "ver" value is not null it still needs to close "nvdev" to return to the orginal state before this function started!
https://github.com/aros-development-team/AROS/blob/02d78b26bb8ea343fa3617e668e0057b1c706c06/workbench/hidds/nouveau/drm/libdrm/nouveau/nouveau_device.c#L50
In the if-statement this return error no. is returned without closing "nvdev". Yet in the next if-statement "nvdev" is closed! This must cause a memory leak if the first path is followed? Because even if "ver" value is not null it still needs to close "nvdev" to return to the orginal state before this function started!