summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2023-11-01 19:37:44 -0400
committerRich Felker <dalias@aerifal.cx>2023-11-06 13:29:07 -0500
commit2d84486a08c57d00b647586b7cbe2dcec2728e81 (patch)
tree206f6e80ff67c208e180b6d28bcb0232c217602d /src
parentc5459df18879dad8f5388480d588edbcbd1b7eb2 (diff)
downloadmusl-2d84486a08c57d00b647586b7cbe2dcec2728e81.tar.gz
__year_to_secs: fix dangling pointer
The lifetime of the compound literal ends after the "if" statement's implicit block. gcc also warns about this.
Diffstat (limited to 'src')
-rw-r--r--src/time/__year_to_secs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/time/__year_to_secs.c b/src/time/__year_to_secs.c
index 2824ec6d..b42f5a6d 100644
--- a/src/time/__year_to_secs.c
+++ b/src/time/__year_to_secs.c
@@ -10,9 +10,9 @@ long long __year_to_secs(long long year, int *is_leap)
return 31536000*(y-70) + 86400*leaps;
}
- int cycles, centuries, leaps, rem;
+ int cycles, centuries, leaps, rem, dummy;
- if (!is_leap) is_leap = &(int){0};
+ if (!is_leap) is_leap = &dummy;
cycles = (year-100) / 400;
rem = (year-100) % 400;
if (rem < 0) {