aboutsummaryrefslogtreecommitdiff
path: root/time/tzset.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2015-04-27 15:41:03 +0200
committerFlorian Weimer <fweimer@redhat.com>2015-04-27 16:19:55 +0200
commitcc8dcf96e71dd643f929e32150904cd6ad69efa8 (patch)
tree0711c094ad29df752a51ffff7120f7b48a945dfd /time/tzset.c
parent2dd6ee79b19ccfdd7f68cd534b8b71f77479132b (diff)
downloadglibc-cc8dcf96e71dd643f929e32150904cd6ad69efa8.tar
glibc-cc8dcf96e71dd643f929e32150904cd6ad69efa8.tar.gz
glibc-cc8dcf96e71dd643f929e32150904cd6ad69efa8.tar.bz2
glibc-cc8dcf96e71dd643f929e32150904cd6ad69efa8.zip
test-skeleton: Support temporary files without memory leaks [BZ#18333]
add_temp_file now makes a copy which is freed by delete_temp_files. Callers to create_temp_file can now free the returned file name to avoid the memory leak. These changes do not affect the leak behavior of existing code. Also address a NULL pointer derefence in tzset after a memoru allocation failure, found during testing.
Diffstat (limited to 'time/tzset.c')
-rw-r--r--time/tzset.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/time/tzset.c b/time/tzset.c
index d115bae0be..160f5ad460 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -201,7 +201,12 @@ parse_tzname (const char **tzp, int whichrule)
if (*p++ != '>' || len < 3)
return false;
}
- tz_rules[whichrule].name = __tzstring_len (start, len);
+
+ const char *name = __tzstring_len (start, len);
+ if (name == NULL)
+ return false;
+ tz_rules[whichrule].name = name;
+
*tzp = p;
return true;
}