svace fix 69/183169/2 accepted/tizen/unified/20180704.154019 submit/tizen/20180704.010647
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Tue, 3 Jul 2018 06:29:05 +0000 (15:29 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 3 Jul 2018 06:50:09 +0000 (15:50 +0900)
Change-Id: I35d4440f60d1ef2468bd07a7afea1545c5178ded
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
src/storage/storage.c

index 8e9848b..545514a 100755 (executable)
@@ -131,7 +131,7 @@ static void write_file()
 static void memcleanup_send_broadcast(struct storage_config_info *info, enum memnoti_level level, enum memnoti_level prev_level)
 {
        time_t t;
-       struct tm *timeinfo;
+       struct tm timeinfo;
        enum tzplatform_variable path;
        char *value;
        char buf[20];
@@ -160,10 +160,15 @@ static void memcleanup_send_broadcast(struct storage_config_info *info, enum mem
        write_file();
 
        t = time(NULL);
-       timeinfo = localtime(&t);
-       strftime(buf, sizeof(buf), "%b %d %T", timeinfo);
+       if (localtime_r(&t, &timeinfo) == NULL) {
+               _E("Failed to localtime_r");
+               goto out;
+       }
+
+       strftime(buf, sizeof(buf), "%b %d %T", &timeinfo);
        _D("time: %s path: %d level: %s", buf, path, value);
 
+out:
        dbus_handle_broadcast_dbus_signal_var(STORAGED_PATH_LOWMEM, STORAGED_INTERFACE_LOWMEM,
                        SIGNAL_NEED_CLEANUP, g_variant_new("(is)", path, value));