1
0
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:
Florian Weimer
2015-04-27 15:41:03 +02:00
parent 2dd6ee79b1
commit cc8dcf96e7
4 changed files with 36 additions and 7 deletions

View File

@ -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;
}