summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vibrator.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vibrator.c b/src/vibrator.c
index e758c31..86b6ed0 100644
--- a/src/vibrator.c
+++ b/src/vibrator.c
@@ -291,6 +291,11 @@ check_pattern:
converted_pattern = profile->get_strong_buzz(pattern);
temp = strdup(profile->str_pattern(converted_pattern));
+ if (!temp) {
+ _E("Failed to get vibration string pattern"); //LCOV_EXCL_LINE
+ return -ENOMEM; //LCOV_EXCL_LINE
+ }
+
data = trim_str(temp);
if (!data) {
free(temp); //LCOV_EXCL_LINE
@@ -374,6 +379,11 @@ static int vibrator_is_supported(int pattern, bool *supported)
/* get vibration data */
temp = strdup(profile->str_pattern(pattern));
+ if (!temp) {
+ _E("Failed to get vibration string pattern"); //LCOV_EXCL_LINE
+ return -ENOMEM; //LCOV_EXCL_LINE
+ }
+
data = trim_str(temp);
if (!data) {
free(temp); //LCOV_EXCL_LINE