Fix build warning based on GCC-9
[platform/core/appfw/alarm-manager.git] / server / alarm-manager-util.c
index 55a078a..dce5c4b 100644 (file)
@@ -510,10 +510,8 @@ void _save_alarm_info_log(const char *tag, __alarm_info_t *info)
        char *due_time_str = ctime(&(info->due_time));
        if (due_time_str)
                due_time_str[strlen(due_time_str) - 1] = '\0'; /* to avoid new line */
-
-       char *timebuf = strdup(ctime(&info->due_time));
-       if (timebuf)
-               timebuf[strlen(timebuf) - 1] = '\0'; /* to avoid new line */
+       else
+               due_time_str = "NULL";
 
        snprintf(log_message, sizeof(log_message),
                "alarmID: %d, uid: %d, caller : %s -> callee : %s, "
@@ -523,10 +521,7 @@ void _save_alarm_info_log(const char *tag, __alarm_info_t *info)
                info->alarm_id, info->uid, info->app_unique_name, info->callee_pkgid,
                info->dst_service_name, info->dst_service_name_mod,
                info->alarm_info.alarm_type, info->alarm_info.mode.repeat,
-               info->alarm_info.mode.u_interval.interval, info->due_time, timebuf);
-
-       if (timebuf)
-               free(timebuf);
+               info->alarm_info.mode.u_interval.interval, info->due_time, due_time_str);
 
        _save_module_log(tag, log_message);
 #endif /* _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG */