summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Mahaveer2016-10-19 17:40:02 -0500
committerVishal Mahaveer2016-10-19 17:43:46 -0500
commit1b1b5a2e5e995f607c22651579b49aa98d08610a (patch)
treec10d6430b9ec79e0e0778d5aa7c1be27fb827d4e /memplugin_android.c
parent281e466ff5b0344f538ec4e76076290e60774516 (diff)
downloadhardware-ti-libdce-1b1b5a2e5e995f607c22651579b49aa98d08610a.tar.gz
hardware-ti-libdce-1b1b5a2e5e995f607c22651579b49aa98d08610a.tar.xz
hardware-ti-libdce-1b1b5a2e5e995f607c22651579b49aa98d08610a.zip
libdce [Android]: avoid crash in memplugin_close
Add more checks to prevent crash scenarios in memplugin_close. Change-Id: Ieafc2bbd7a6876059926f37619b017d9cbb5a21d Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
Diffstat (limited to 'memplugin_android.c')
-rw-r--r--memplugin_android.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/memplugin_android.c b/memplugin_android.c
index 97ea44a..f16a976 100644
--- a/memplugin_android.c
+++ b/memplugin_android.c
@@ -81,9 +81,12 @@ int memplugin_open()
81 81
82int memplugin_close() 82int memplugin_close()
83{ 83{
84 omap_device_del(OmapDev); 84 if (OmapDev) {
85 OmapDev = NULL; 85 omap_device_del(OmapDev);
86 if (OmapDrm_FD) { 86 OmapDev = NULL;
87 }
88
89 if (OmapDrm_FD > 0) {
87 close(OmapDrm_FD); 90 close(OmapDrm_FD);
88 OmapDrm_FD = INVALID_DRM_FD; 91 OmapDrm_FD = INVALID_DRM_FD;
89 } 92 }