public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH] unit: fix memory leaks in test-dpp
Date: Mon, 06 Dec 2021 15:51:26 -0800	[thread overview]
Message-ID: <20211206235126.1384140-1-prestwoj@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

---
 unit/test-dpp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/unit/test-dpp.c b/unit/test-dpp.c
index d687bba0..1d4846c7 100644
--- a/unit/test-dpp.c
+++ b/unit/test-dpp.c
@@ -31,6 +31,7 @@
 
 #include "src/dpp-util.h"
 #include "src/util.h"
+#include "ell/useful.h"
 
 /*
  * B.2 Test Vectors for DPP Authentication Using P-256 for
@@ -68,12 +69,13 @@ static void test_key_derivation(const void *data)
 {
 	uint64_t tmp[L_ECC_MAX_DIGITS];
 	const struct l_ecc_curve *curve = l_ecc_curve_from_ike_group(19);
-	struct l_ecc_point *i_proto_public;
-	struct l_ecc_point *r_boot_public;
-	struct l_ecc_scalar *r_boot_private;
-	struct l_ecc_scalar *r_proto_private;
-	struct l_ecc_point *r_proto_public;
-	struct l_ecc_scalar *m, *n;
+	_auto_(l_ecc_point_free) struct l_ecc_point *i_proto_public = NULL;
+	_auto_(l_ecc_point_free) struct l_ecc_point *r_boot_public = NULL;
+	_auto_(l_ecc_scalar_free) struct l_ecc_scalar *r_boot_private = NULL;
+	_auto_(l_ecc_scalar_free) struct l_ecc_scalar *r_proto_private = NULL;
+	_auto_(l_ecc_point_free) struct l_ecc_point *r_proto_public = NULL;
+	_auto_(l_ecc_scalar_free) struct l_ecc_scalar *m = NULL;
+	_auto_(l_ecc_scalar_free) struct l_ecc_scalar *n = NULL;
 	uint64_t k1[L_ECC_MAX_DIGITS];
 	uint64_t k2[L_ECC_MAX_DIGITS];
 	uint64_t ke[L_ECC_MAX_DIGITS];
-- 
2.31.1

             reply	other threads:[~2021-12-06 23:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 23:51 James Prestwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-12-07  0:45 [PATCH] unit: fix memory leaks in test-dpp Denis Kenzior

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=20211206235126.1384140-1-prestwoj@gmail.com \
    --to=iwd@lists.linux.dev \
    /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