From: Szymon Janc Date: Tue, 7 Aug 2012 12:22:34 +0000 (+0200) Subject: snep: Fix possible memory leak in snep_read X-Git-Tag: 0.6~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a4dde0e2768128956457ab3d7706cf7407ee32f;p=platform%2Fupstream%2Fneard.git snep: Fix possible memory leak in snep_read Free previously allocated snep_data if nfc_data allocation failed before returning error. --- diff --git a/plugins/snep.c b/plugins/snep.c index 8a8c3b6..c5d5d00 100644 --- 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;