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:
2d71e69
)
nfctype2: Fix possible NULL pointer dereference in data_write
author
Szymon Janc
<szymon.janc@tieto.com>
Tue, 7 Aug 2012 12:22:28 +0000
(14:22 +0200)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Tue, 14 Aug 2012 15:13:49 +0000
(17:13 +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
4a9405d
..
50ae94f
100644
(file)
--- a/
plugins/nfctype2.c
+++ b/
plugins/nfctype2.c
@@
-390,6
+390,9
@@
static int data_write(uint32_t adapter_idx, uint32_t target_idx,
DBG("");
cookie = g_try_malloc0(sizeof(struct t2_cookie));
+ if (cookie == NULL)
+ return -ENOMEM;
+
cookie->adapter_idx = adapter_idx;
cookie->target_idx = target_idx;
cookie->current_block = DATA_BLOCK_START;