summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2017-02-22 14:08:02 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-25 10:32:03 -0800
commitdec50797af68464ba85017e01b3f0dfc684d90cb (patch)
tree7ffb296be97a2cf521a1260fb5dd3f4630b2248e
parentb1b5cf7ee83a7f70c23f015a53a34948bf23dd11 (diff)
downloadvboot-dec50797af68464ba85017e01b3f0dfc684d90cb.tar.gz
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 <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--futility/cmd_sign.c2
-rw-r--r--futility/file_type_rwsig.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/futility/cmd_sign.c b/futility/cmd_sign.c
index 63bbfea0..d0c053b4 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 40669a6b..9561f6cf 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;
}