projects
/
platform
/
upstream
/
neard.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
856f9ad
)
nfctype2: Fix possible NULL pointer dereference in nfctype2_read_meta
author
Szymon Janc
<szymon.janc@tieto.com>
Tue, 7 Aug 2012 12:22:26 +0000
(14:22 +0200)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Tue, 14 Aug 2012 15:11:02 +0000
(17:11 +0200)
Check if memory allocation succeed before dereferencing pointer.
plugins/nfctype2.c
patch
|
blob
|
history
diff --git
a/plugins/nfctype2.c
b/plugins/nfctype2.c
index
d268011
..
e5cf764
100644
(file)
--- a/
plugins/nfctype2.c
+++ b/
plugins/nfctype2.c
@@
-275,6
+275,9
@@
static int nfctype2_read_meta(uint32_t adapter_idx, uint32_t target_idx,
cmd.block = META_BLOCK_START;
cookie = g_try_malloc0(sizeof(struct t2_cookie));
+ if (cookie == NULL)
+ return -ENOMEM;
+
cookie->adapter_idx = adapter_idx;
cookie->target_idx = target_idx;
cookie->cb = cb;