]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
time: reduce scope of static string
authorVictor Julien <vjulien@oisf.net>
Wed, 27 Apr 2022 19:28:53 +0000 (21:28 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 9 May 2022 14:07:18 +0000 (16:07 +0200)
src/util-time.c

index 5cfa38a340868c2c0ccd6e5bf3cd7db045c6cbc6..31864353112e8e8493148ccb1c458a25d20e16ee 100644 (file)
@@ -237,9 +237,9 @@ void CreateUtcIsoTimeString (const struct timeval *ts, char *str, size_t size)
     struct tm local_tm;
     memset(&local_tm, 0, sizeof(local_tm));
     struct tm *t = (struct tm*)SCUtcTime(time, &local_tm);
-    char time_fmt[64] = { 0 };
 
     if (likely(t != NULL)) {
+        char time_fmt[64] = { 0 };
         strftime(time_fmt, sizeof(time_fmt), "%Y-%m-%dT%H:%M:%S", t);
         snprintf(str, size, time_fmt, ts->tv_usec);
     } else {