From: INSUN PYO Date: Fri, 13 Oct 2017 02:15:25 +0000 (+0000) Subject: Coverity fixes. X-Git-Tag: accepted/tizen/unified/20171019.060906^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83d62a90a4db7f4387cc9b826348c341426b4f63;p=platform%2Fcore%2Fsystem%2Ffeedbackd.git Coverity fixes. Signed-off-by: INSUN PYO Change-Id: I9201254a8076891148aadb9a6932bebaef4263a4 --- diff --git a/src/haptic/standard-vibcore.c b/src/haptic/standard-vibcore.c index 510b717..4e40c22 100644 --- a/src/haptic/standard-vibcore.c +++ b/src/haptic/standard-vibcore.c @@ -71,15 +71,14 @@ static int vibration_load_config(struct parse_result *result, void *user_data) } conf->pattern = strdup(result->name); - if (!conf->pattern) + if (!conf->pattern) { _E("fail to copy %s pattern data", result->name); + free(conf); + return -ENOMEM; + } value = result->value; - - if (!value) - len = 0; - else - len = strlen(value); + len = strlen(value); if (len == 0) { data = (struct duration_data *)malloc(sizeof(struct duration_data)); @@ -97,6 +96,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data) return 0; } + /* value : 100D or 100D0W or 250D250W250D750W*/ do { data = (struct duration_data *)malloc(sizeof(struct duration_data)); if (!data) { @@ -112,26 +112,22 @@ static int vibration_load_config(struct parse_result *result, void *user_data) if (check) { *check = '\0'; data->duration = strtol(value, NULL, 10); - if (!value) - len = len - 1; - else - len = len - strlen(value) - 1; + len = len - strlen(value) - 1; value = check + 1; } + check = strchr(value, 'W'); if (check) { *check = '\0'; data->wait = strtol(value, NULL, 10); - if (!value) - len = len - 1; - else - len = len - strlen(value) - 1; + len = len - strlen(value) - 1; value = check + 1; } + DD_LIST_APPEND(conf->data, data); if (data->duration == 0 && data->wait == 0) break; - } while (value && len > 0); + } while (len > 0); DD_LIST_APPEND(vib_conf_list, conf);