[wireless-regdb] [PATCH 17/40] crda: use gcry_mpi_release() when using gcry_mpi_scan()

Luis R. Rodriguez mcgrof at do-not-panic.com
Thu May 30 22:09:06 EDT 2013


From: "Luis R. Rodriguez" <mcgrof at do-not-panic.com>

Its not well documented you should do this but I found out
through valgrind. This fixes the last 4 valgrind issues
I was seeing with regdbdump.

Signed-off-by: Luis R. Rodriguez <mcgrof at do-not-panic.com>
---
 reglib.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/reglib.c b/reglib.c
index 3d13782..72ea78f 100644
--- a/reglib.c
+++ b/reglib.c
@@ -158,10 +158,14 @@ int crda_verify_db_signature(uint8_t *db, int dblen, int siglen)
 				    "(public-key (rsa (n %m) (e %m)))",
 				    mpi_n, mpi_e)) {
 			fprintf(stderr, "Failed to build RSA S-expression.\n");
+			gcry_mpi_release(mpi_e);
+			gcry_mpi_release(mpi_n);
 			goto out;
 		}
 
 		ok = gcry_pk_verify(signature, data, rsa) == 0;
+		gcry_mpi_release(mpi_e);
+		gcry_mpi_release(mpi_n);
 		gcry_sexp_release(rsa);
 	}
 
-- 
1.7.10.4




More information about the wireless-regdb mailing list