[PATCH 39/59] Free earlier in __tzfile_read
Paul Eggert
eggert@cs.ucla.edu
Sun Jan 5 05:57:14 GMT 2025
* time/tzfile.c (__tzfile_read): Free NEW earlier, to help the
heap manager and remove the need for a goto.
---
time/tzfile.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/time/tzfile.c b/time/tzfile.c
index 09ebc7d8ea..d600b88e89 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -202,11 +202,15 @@ __tzfile_read (const char *file)
&& __stat64_time64 (file, &st) == 0
&& tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
&& tzfile_mtime == st.st_mtime)
- goto done; /* Nothing to do. */
+ {
+ free (new);
+ return true;
+ }
/* Note the file is opened with cancellation in the I/O functions
disabled and if available FD_CLOEXEC set. */
f = fopen (file, "rce");
+ free (new);
if (f == NULL)
goto ret_free_transitions;
off_t f_offset = 0;
@@ -576,14 +580,11 @@ __tzfile_read (const char *file)
tzfile_ino = st.st_ino;
tzfile_mtime = st.st_mtime;
- done:
- free (new);
return true;
lose:
fclose (f);
ret_free_transitions:
- free (new);
free (transitions);
transitions = NULL;
tzfile_mtime = 0;
--
2.45.2
More information about the Libc-alpha
mailing list