From dec50797af68464ba85017e01b3f0dfc684d90cb Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 22 Feb 2017 14:08:02 +0800 Subject: [PATCH] cmd_sign/rwsig: Free sign_option.prikey in the main function It's better to free it in the same function as it was allocated. BRANCH=none BUG=none TEST=make runtests Change-Id: I7a224364c4b1afce5a274b944d32fc1b7ba5db30 Reviewed-on: https://chromium-review.googlesource.com/446177 Commit-Ready: Nicolas Boichat Tested-by: Nicolas Boichat Reviewed-by: Vincent Palatin --- futility/cmd_sign.c | 2 ++ futility/file_type_rwsig.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/futility/cmd_sign.c b/futility/cmd_sign.c index 63bbfea0ae..d0c053b4cc 100644 --- a/futility/cmd_sign.c +++ b/futility/cmd_sign.c @@ -1051,6 +1051,8 @@ done: free(sign_option.keyblock); if (sign_option.kernel_subkey) free(sign_option.kernel_subkey); + if (sign_option.prikey) + vb2_private_key_free(sign_option.prikey); if (errorcnt) fprintf(stderr, "Use --help for usage instructions\n"); diff --git a/futility/file_type_rwsig.c b/futility/file_type_rwsig.c index 40669a6b49..9561f6cf64 100644 --- a/futility/file_type_rwsig.c +++ b/futility/file_type_rwsig.c @@ -212,8 +212,6 @@ int ft_sign_rwsig(const char *name, uint8_t *buf, uint32_t len, void *data) done: if (sig) free(sig); - if (sign_option.prikey) - vb2_private_key_free(sign_option.prikey); return retval; }