Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Unified Diff: src/platform/vboot_reference/utils/signature_digest.c

Issue 858008: VBoot Reference: Fix many memory leaks. (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/utils/signature_digest.c
diff --git a/src/platform/vboot_reference/utils/signature_digest.c b/src/platform/vboot_reference/utils/signature_digest.c
index 23c47dfa0a1b97e1b47dbcd16b616a19504e83de..8f4c23890a07395e4f09a0056604170ce618ea55 100644
--- a/src/platform/vboot_reference/utils/signature_digest.c
+++ b/src/platform/vboot_reference/utils/signature_digest.c
@@ -52,6 +52,7 @@ uint8_t* SignatureBuf(const uint8_t* buf, uint64_t len, const char* key_file,
key_fp = fopen(key_file, "r");
if (!key_fp) {
fprintf(stderr, "SignatureBuf(): Couldn't open key file: %s\n", key_file);
+ Free(signature_digest);
return NULL;
}
if ((key = PEM_read_RSAPrivateKey(key_fp, NULL, NULL, NULL)))
@@ -67,6 +68,7 @@ uint8_t* SignatureBuf(const uint8_t* buf, uint64_t len, const char* key_file,
RSA_PKCS1_PADDING)) /* Padding to use. */
fprintf(stderr, "SignatureBuf(): RSA_private_encrypt() failed.\n");
}
+ fclose(key_fp);
if (key)
RSA_free(key);
Free(signature_digest);

Powered by Google App Engine
This is Rietveld 408576698