From 01e57b5d91b0c9f2ac93708c5c2cbcd4731ddd34 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Mon, 23 Jun 2014 09:05:47 +0200 Subject: gpg-interface: provide clear helper for struct signature_check The struct has been growing members whose malloced memory needs to be freed. Do this with one helper function so that no malloced memory shall be left unfreed. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- gpg-interface.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gpg-interface.c') diff --git a/gpg-interface.c b/gpg-interface.c index 8b0e87436..e71b59daf 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -7,6 +7,18 @@ static char *configured_signing_key; static const char *gpg_program = "gpg"; +void signature_check_clear(struct signature_check *sigc) +{ + free(sigc->gpg_output); + free(sigc->gpg_status); + free(sigc->signer); + free(sigc->key); + sigc->gpg_output = NULL; + sigc->gpg_status = NULL; + sigc->signer = NULL; + sigc->key = NULL; +} + void set_signing_key(const char *key) { free(configured_signing_key); -- cgit v1.2.1