drm: Branch 'master'

[email protected] (Rob Clark)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 freedreno/freedreno_device.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f45853802e910fd472f368a2d461708491fedfa3
Author: Rob Clark <[email protected]>
Date:   Sat Apr 15 14:43:17 2017 -0400

    freedreno: fix double-free on exit
    
    Fixes: a07ae97 ("freedreno: fix device close issues")
    Signed-off-by: Rob Clark <[email protected]>

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)
 
 static void fd_device_del_impl(struct fd_device *dev)
 {
+	int close_fd = dev->closefd ? dev->fd : -1;
 	fd_bo_cache_cleanup(&dev->bo_cache, 0);
 	drmHashDestroy(dev->handle_table);
 	drmHashDestroy(dev->name_table);
 	dev->funcs->destroy(dev);
-	if (dev->closefd)
-		close(dev->fd);
-	free(dev);
+	if (close_fd >= 0)
+		close(close_fd);
 }
 
 drm_private void fd_device_del_locked(struct fd_device *dev)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.