summaryrefslogtreecommitdiffstats
path: root/gralloc_drm_handle.h
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2011-07-30 15:43:48 +0900
committerChia-I Wu <olvaffe@gmail.com>2011-07-30 16:38:01 +0900
commit75ee75c2115109c1385677c8a92f8ace27a48b60 (patch)
treedc1d838dc8a98c934b8951cdfeb7d206e2bda754 /gralloc_drm_handle.h
parent1db540381c30f11ecb87995f8bb7e1ee0a3f1b9c (diff)
downloadexternal_drm_gralloc-75ee75c2115109c1385677c8a92f8ace27a48b60.zip
external_drm_gralloc-75ee75c2115109c1385677c8a92f8ace27a48b60.tar.gz
external_drm_gralloc-75ee75c2115109c1385677c8a92f8ace27a48b60.tar.bz2
protect against NULL handle
Diffstat (limited to 'gralloc_drm_handle.h')
-rw-r--r--gralloc_drm_handle.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/gralloc_drm_handle.h b/gralloc_drm_handle.h
index 343ace0..383719e 100644
--- a/gralloc_drm_handle.h
+++ b/gralloc_drm_handle.h
@@ -51,10 +51,10 @@ static inline struct gralloc_drm_handle_t *gralloc_drm_handle(buffer_handle_t _h
struct gralloc_drm_handle_t *handle =
(struct gralloc_drm_handle_t *) _handle;
- if (handle->base.version != sizeof(handle->base) ||
- handle->base.numInts != GRALLOC_DRM_HANDLE_NUM_INTS ||
- handle->base.numFds != GRALLOC_DRM_HANDLE_NUM_FDS ||
- handle->magic != GRALLOC_DRM_HANDLE_MAGIC)
+ if (handle && (handle->base.version != sizeof(handle->base) ||
+ handle->base.numInts != GRALLOC_DRM_HANDLE_NUM_INTS ||
+ handle->base.numFds != GRALLOC_DRM_HANDLE_NUM_FDS ||
+ handle->magic != GRALLOC_DRM_HANDLE_MAGIC))
handle = NULL;
return handle;