Skip to content
Commit 8c4a1cbd authored by Matt Roper's avatar Matt Roper Committed by Emil Velikov
Browse files

xf86drm: Fix error handling for drmGetDevices()



If the opendir() call in drmGetDevices() returns failure, we jump to an
error label that calls closedir() and then returns.  However this means
that we're calling closedir(NULL) which may not be safe on all
implementations.  We are also leaking the local_devices array that was
allocated before the opendir() call.

Fix both of these issues by jumping to an earlier error label (to free
local_devices) and guarding the closedir() call with a NULL test.

Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
[Emil Velikov: make the teardown symmetrical, remove the NULL check]
Signed-off-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
parent 4031dc17
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment