From 3e4532c1f80882480ec096b7e2dd6e0de87c820d Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Tue, 3 Jul 2018 15:29:05 +0900 Subject: [PATCH] svace fix Change-Id: I35d4440f60d1ef2468bd07a7afea1545c5178ded Signed-off-by: sanghyeok.oh --- src/storage/storage.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/storage/storage.c b/src/storage/storage.c index 8e9848b..545514a 100755 --- a/src/storage/storage.c +++ b/src/storage/storage.c @@ -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)); -- 2.7.4