From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: linux-nfc@lists.01.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Subject: [linux-nfc] [neard][PATCH 5/7] unit: fix memory leaks in test-snep-read error paths
Date: Fri, 16 Jul 2021 12:08:42 +0200 [thread overview]
Message-ID: <20210716100844.51360-6-krzysztof.kozlowski@canonical.com> (raw)
In-Reply-To: <20210716100844.51360-1-krzysztof.kozlowski@canonical.com>
Cleanup and free memory in error paths in test-snep-read.c.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
unit/test-snep-read.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/unit/test-snep-read.c b/unit/test-snep-read.c
index 0a2010a677e1..3bc1a9fad7df 100644
--- a/unit/test-snep-read.c
+++ b/unit/test-snep-read.c
@@ -131,12 +131,12 @@ static bool test_snep_dummy_req_put(int fd, void *data)
records = near_ndef_parse_msg(nfc_data, nfc_data_length, NULL);
if (!records) {
TEST_SNEP_LOG("\tdummy_req_put parsing ndef failed\n");
- goto error;
+ goto error_free_nfc_data;
}
if (g_list_length(records) != 1) {
TEST_SNEP_LOG("\tdummy_req_put records number mismatch");
- goto error;
+ goto error_free_records;
}
g_free(nfc_data);
@@ -149,6 +149,10 @@ static bool test_snep_dummy_req_put(int fd, void *data)
near_snep_core_response_noinfo(fd, NEAR_SNEP_RESP_SUCCESS);
return true;
+error_free_records:
+ near_ndef_records_free(records);
+error_free_nfc_data:
+ g_free(nfc_data);
error:
TEST_SNEP_LOG("\tdummy_req_put error!!!\n");
return false;
--
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
next prev parent reply other threads:[~2021-07-16 10:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 10:08 [linux-nfc] [neard][PATCH 0/7] Fixes for more memory issues Krzysztof Kozlowski
2021-07-16 10:08 ` [linux-nfc] [neard][PATCH 1/7] snep: do not open-code freeing ndef message Krzysztof Kozlowski
2021-07-16 10:08 ` [linux-nfc] [neard][PATCH 2/7] unit: fix memory leaks in test-ndef-build Krzysztof Kozlowski
2021-07-16 10:08 ` [linux-nfc] [neard][PATCH 3/7] snep: remove useless NULL-ify of local pointer variable Krzysztof Kozlowski
2021-07-16 10:08 ` [linux-nfc] [neard][PATCH 4/7] snep: fix double free of GSList Krzysztof Kozlowski
2021-07-16 10:08 ` Krzysztof Kozlowski [this message]
2021-07-16 10:08 ` [linux-nfc] [neard][PATCH 6/7] unit: fix record memory leak in test-snep-read Krzysztof Kozlowski
2021-07-16 10:08 ` [linux-nfc] [neard][PATCH 7/7] unit: fix records GList " Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210716100844.51360-6-krzysztof.kozlowski@canonical.com \
--to=krzysztof.kozlowski@canonical.com \
--cc=linux-nfc@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).