From 31404e58e99e833a13ed282bf331df037d2714a8 Mon Sep 17 00:00:00 2001 From: Mattias Nissler Date: Tue, 7 Jun 2016 16:31:24 +0200 Subject: [PATCH] fs_mgr: Remove incorrect free() on error paths in load_key() This fixes a bug introduced by https://android-review.googlesource.com/#/c/212781/ which would make fs_mgr crash when hitting one of the error paths. Bug: 28585197 Change-Id: I40e6612e2eb3e6f584e70c608afc6d4378d73c4f --- fs_mgr/fs_mgr_verity.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs_mgr/fs_mgr_verity.cpp b/fs_mgr/fs_mgr_verity.cpp index 72554a8ee..aa326007f 100644 --- a/fs_mgr/fs_mgr_verity.cpp +++ b/fs_mgr/fs_mgr_verity.cpp @@ -91,14 +91,12 @@ static RSA *load_key(const char *path) FILE* f = fopen(path, "r"); if (!f) { ERROR("Can't open '%s'\n", path); - free(key_data); return NULL; } if (!fread(key_data, sizeof(key_data), 1, f)) { ERROR("Could not read key!\n"); fclose(f); - free(key_data); return NULL; } @@ -107,7 +105,6 @@ static RSA *load_key(const char *path) RSA* key = NULL; if (!android_pubkey_decode(key_data, sizeof(key_data), &key)) { ERROR("Could not parse key!\n"); - free(key_data); return NULL; }