diff --git a/keymaster_configuration.cpp b/keymaster_configuration.cpp index 428197c..42df7d6 100644 --- a/keymaster_configuration.cpp +++ b/keymaster_configuration.cpp @@ -89,7 +89,10 @@ } regmatch_t matches[kPlatformVersionMatchCount]; - if (regexec(®ex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */)) { + int not_match + = regexec(®ex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */); + regfree(®ex); + if (not_match) { ALOGI("Platform version string does not match expected format. Using version 0."); return 0; } @@ -109,7 +112,10 @@ } regmatch_t matches[kPlatformPatchlevelMatchCount]; - if (regexec(®ex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */)) { + int not_match + = regexec(®ex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */); + regfree(®ex); + if (not_match) { ALOGI("Platform patchlevel string does not match expected format. Using patchlevel 0"); return 0; }