summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2012-10-18 12:21:52 +0100
committerRussell King <rmk@arm.linux.org.uk>2012-10-20 22:04:17 +0100
commit9b12604700d9ecb9ab07746c8fd29402c5dac7d6 (patch)
treee69e6dccef3f4960e1e835735e8cb241a8d331ed
parentd88eade866fd671470a7b599c08000de25118886 (diff)
Only memset() _after_ checking the returned pointer for NULL, not before
-rw-r--r--vmeta_lib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/vmeta_lib.c b/vmeta_lib.c
index 109e632..364c035 100644
--- a/vmeta_lib.c
+++ b/vmeta_lib.c
@@ -431,12 +431,11 @@ SIGN32 vdec_os_driver_init(void)
// Prepare the vdec os driver control interface
vdec_iface = malloc(sizeof(vdec_os_driver_cb_t));
- memset(vdec_iface, 0, sizeof(vdec_os_driver_cb_t));
- if(vdec_iface == NULL)
- {
+ if(vdec_iface == NULL) {
pthread_mutex_unlock(&pmt);
return -VDEC_OS_DRIVER_INIT_FAIL;
}
+ memset(vdec_iface, 0, sizeof(vdec_os_driver_cb_t));
// initialize reference count
vdec_iface->refcount++;