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:
1d4cf79
)
snep: Fix possible memory leak in snep_read
author
Szymon Janc
<szymon.janc@tieto.com>
Tue, 7 Aug 2012 12:22:34 +0000
(14:22 +0200)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Tue, 14 Aug 2012 15:28:46 +0000
(17:28 +0200)
Free previously allocated snep_data if nfc_data allocation failed
before returning error.
plugins/snep.c
patch
|
blob
|
history
diff --git
a/plugins/snep.c
b/plugins/snep.c
index
8a8c3b6
..
c5d5d00
100644
(file)
--- a/
plugins/snep.c
+++ b/
plugins/snep.c
@@
-242,8
+242,10
@@
static near_bool_t snep_read(int client_fd,
return FALSE;
snep_data->nfc_data = g_try_malloc0(ndef_length + TLV_SIZE);
- if (snep_data->nfc_data == NULL)
+ if (snep_data->nfc_data == NULL) {
+ g_free(snep_data);
return FALSE;
+ }
snep_data->nfc_data_length = ndef_length;
snep_data->nfc_data_ptr = snep_data->nfc_data;