mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user