aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2021-07-14 12:26:30 +0200
committerKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2021-07-19 12:44:07 +0200
commited85ddb81e7645bf9d68150afc0ad53340feb2a0 (patch)
tree0e338de18a6bcd8325f6e92515606516aff1968c
parent69f7a05a42029e64756ac2012090623036a6452f (diff)
downloadneard-ed85ddb81e7645bf9d68150afc0ad53340feb2a0.tar.gz
snep-send: fix near_ndef_message memory leak
The result of near_ndef_prepare_text_record() should be freed, otherwise it leaks making ASAN and valgrind unhappy. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
-rw-r--r--tools/snep-send.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/snep-send.c b/tools/snep-send.c
index 5bb1532..53f5325 100644
--- a/tools/snep-send.c
+++ b/tools/snep-send.c
@@ -91,6 +91,7 @@ int main(int argc, char *argv[])
frame = g_try_malloc0(frame_length);
if (!frame) {
close(fd);
+ near_ndef_msg_free(ndef);
near_error("Could not allocate SNEP frame");
return -1;
}
@@ -100,6 +101,7 @@ int main(int argc, char *argv[])
frame->length = GUINT_TO_BE(ndef->length);
memcpy(frame->ndef, ndef->data, ndef->length);
+ near_ndef_msg_free(ndef);
len = send(fd, (uint8_t *)frame, frame_length, 0);
if (len < 0) {