diff options
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index ce76d83638..ae6eb3e172 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -192,11 +192,14 @@ e_ctime (const time_t *timep) { static char *buffer[4] = { 0, }; static int next = 0; + const char *ret; g_free (buffer[next]); - buffer[next] = g_strdup (ctime (timep)); + ret = buffer[next++] = g_strdup (ctime (timep)); + if (next >= G_N_ELEMENTS (buffer)) + next = 0; - return buffer[next++]; + return ret; } /* Queues an alarm trigger for midnight so that we can load the next day's worth |