This patch is for solving static analysis issues.
Through this patch, the scope of each temporary variables will become as
smaller as they can. This change can reduce the possibility of mistakes
such as accessing invalid pointer.
Change-Id: I93aaef1711ddc27663812fd0c089c9be4c277f23
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
}
if (0 != g_slist_length(cmd_list)) {
- GSList *iter = NULL;
- char* temp_command = NULL;
- iter = g_slist_nth(cmd_list, 0);
+ GSList *iter = g_slist_nth(cmd_list, 0);
while (NULL != iter) {
- temp_command = iter->data;
+ char *temp_command = iter->data;
if (NULL != temp_command) {
if (NULL != tmp_cmd->command) {
if (VC_DB_ERROR_NONE != ret) {
while (NULL != iter) {
- temp_command = iter->data;
+ char *temp_command = iter->data;
if (NULL != temp_command) {
cmd_list = g_slist_remove(cmd_list, temp_command);
int hour = -1;
int min = -1;
- char *tempstr = NULL;
-
*exist = 0;
ret = regexec(®[3], str, 1, pmatch, 0);
if (0 == ret) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
return VC_ERROR_OPERATION_FAILED;
}
- tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
+ char *tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
return VC_ERROR_OPERATION_FAILED;
}
- tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
+ char *tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
int min = -1;
int sidx = -1;
int eidx = -1;
- char *tempstr = NULL;
*exist = 0;
ret = regexec(®[0], str, 5, pmatch, 0);
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
return VC_ERROR_OPERATION_FAILED;
}
- tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
+ char *tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
idx = 1;
len = pmatch[idx].rm_eo - pmatch[idx].rm_so;
if (0 < len) {
- tempstr = strndup(str + pmatch[idx].rm_so, (size_t)len);
+ char *tempstr = strndup(str + pmatch[idx].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
static void __vcd_client_release_each_commands(GSList** cmds)
{
- GSList *iter = NULL;
- vc_cmd_s* temp_cmd;
-
if (0 < g_slist_length(*cmds)) {
- iter = g_slist_nth(*cmds, 0);
+ GSList *iter = g_slist_nth(*cmds, 0);
while (NULL != iter) {
- temp_cmd = iter->data;
+ vc_cmd_s *temp_cmd = iter->data;
if (NULL != temp_cmd) {
if (NULL != temp_cmd->command) {
if (0 != g_slist_length(app_list)) {
/* release data */
- GSList *iter = NULL;
- vc_deactivated_app_s* temp_app = NULL;
- iter = g_slist_nth(app_list, 0);
-
+ GSList *iter = g_slist_nth(app_list, 0);
while (NULL != iter) {
- temp_app = iter->data;
+ vc_deactivated_app_s *temp_app = iter->data;
if (NULL != temp_app && NULL != temp_app->appid) {
int ret = -1;
SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to get pid list. No result");
} else {
if (0 < g_slist_length(pid_list)) {
- GSList* iter = NULL;
- vc_cmd_s* temp_cmd = NULL;
int ret = 0;
int pre_pid = -1;
int pre_type = -1;
- iter = g_slist_nth(pid_list, 0);
+ GSList *iter = g_slist_nth(pid_list, 0);
while (NULL != iter) {
- temp_cmd = iter->data;
+ vc_cmd_s *temp_cmd = iter->data;
if (NULL != temp_cmd && (pre_pid != temp_cmd->pid || pre_type == VC_COMMAND_TYPE_WIDGET || temp_cmd->type == VC_COMMAND_TYPE_WIDGET)) {
/* Launch deactivated several apps that is matched with result */