aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2017-04-15 13:43:17 -0500
committerRob Clark2017-04-15 13:43:17 -0500
commitf45853802e910fd472f368a2d461708491fedfa3 (patch)
tree7ebc7b8e72e47211489f165e3b50176ef2c81010 /freedreno
parentf02719c5246d301a50d7e0356bf3fe61b1e945a1 (diff)
downloadexternal-libdrm-f45853802e910fd472f368a2d461708491fedfa3.tar.gz
external-libdrm-f45853802e910fd472f368a2d461708491fedfa3.tar.xz
external-libdrm-f45853802e910fd472f368a2d461708491fedfa3.zip
freedreno: fix double-free on exit
Fixes: a07ae97 ("freedreno: fix device close issues") Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rw-r--r--freedreno/freedreno_device.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c
index dba7ec47..12b95fd0 100644
--- a/freedreno/freedreno_device.c
+++ b/freedreno/freedreno_device.c
@@ -112,13 +112,13 @@ struct fd_device * fd_device_ref(struct fd_device *dev)
112 112
113static void fd_device_del_impl(struct fd_device *dev) 113static void fd_device_del_impl(struct fd_device *dev)
114{ 114{
115 int close_fd = dev->closefd ? dev->fd : -1;
115 fd_bo_cache_cleanup(&dev->bo_cache, 0); 116 fd_bo_cache_cleanup(&dev->bo_cache, 0);
116 drmHashDestroy(dev->handle_table); 117 drmHashDestroy(dev->handle_table);
117 drmHashDestroy(dev->name_table); 118 drmHashDestroy(dev->name_table);
118 dev->funcs->destroy(dev); 119 dev->funcs->destroy(dev);
119 if (dev->closefd) 120 if (close_fd >= 0)
120 close(dev->fd); 121 close(close_fd);
121 free(dev);
122} 122}
123 123
124drm_private void fd_device_del_locked(struct fd_device *dev) 124drm_private void fd_device_del_locked(struct fd_device *dev)