}
}
-struct fd_device * fd_device_new(int fd)
+drm_public struct fd_device * fd_device_new(int fd)
{
struct fd_device *dev;
drmVersionPtr version;
ERROR_MSG("unknown device: %s", version->name);
dev = NULL;
}
+ drmFreeVersion(version);
if (!dev)
return NULL;
/* like fd_device_new() but creates it's own private dup() of the fd
* which is close()d when the device is finalized.
*/
-struct fd_device * fd_device_new_dup(int fd)
+drm_public struct fd_device * fd_device_new_dup(int fd)
{
struct fd_device *dev = fd_device_new(dup(fd));
- dev->closefd = 1;
+ if (dev)
+ dev->closefd = 1;
return dev;
}
-struct fd_device * fd_device_ref(struct fd_device *dev)
+drm_public struct fd_device * fd_device_ref(struct fd_device *dev)
{
atomic_inc(&dev->refcnt);
return dev;
fd_device_del_impl(dev);
}
-void fd_device_del(struct fd_device *dev)
+drm_public void fd_device_del(struct fd_device *dev)
{
if (!atomic_dec_and_test(&dev->refcnt))
return;