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:
af07f73
)
nfctype3: Fix possible memory leak in nfctype3_read
author
Szymon Janc
<szymon.janc@tieto.com>
Tue, 7 Aug 2012 12:22:32 +0000
(14:22 +0200)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Tue, 14 Aug 2012 15:25:16 +0000
(17:25 +0200)
If call to near_adapter_send() failed cookie should be freed before
returning.
plugins/nfctype3.c
patch
|
blob
|
history
diff --git
a/plugins/nfctype3.c
b/plugins/nfctype3.c
index
6ccadaf
..
7349b88
100644
(file)
--- a/
plugins/nfctype3.c
+++ b/
plugins/nfctype3.c
@@
-403,6
+403,7
@@
static int nfctype3_read(uint32_t adapter_idx,
{
struct type3_cmd cmd;
struct t3_cookie *cookie;
+ int err;
DBG("");
@@
-424,8
+425,12
@@
static int nfctype3_read(uint32_t adapter_idx,
cookie->target_idx = target_idx;
cookie->cb = cb;
- return near_adapter_send(adapter_idx, (uint8_t *)&cmd,
- cmd.len , nfctype3_recv_UID, cookie);
+ err = near_adapter_send(adapter_idx, (uint8_t *)&cmd,
+ cmd.len , nfctype3_recv_UID, cookie);
+ if (err < 0)
+ g_free(cookie);
+
+ return err;
}
static int update_attr_block_cb(uint8_t *resp, int length, void *data)