DivestOS/Patches/LineageOS-14.1/android_system_keymaster/0001-Backport_Fixes.patch

29 lines
1.1 KiB
Diff
Raw Normal View History

2018-03-14 14:30:40 -04:00
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(&regex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */)) {
+ int not_match
+ = regexec(&regex, version_str, kPlatformVersionMatchCount, matches, 0 /* flags */);
+ regfree(&regex);
+ 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(&regex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */)) {
+ int not_match
+ = regexec(&regex, patchlevel_str, kPlatformPatchlevelMatchCount, matches, 0 /* flags */);
+ regfree(&regex);
+ if (not_match) {
ALOGI("Platform patchlevel string does not match expected format. Using patchlevel 0");
return 0;
}