about summary refs log tree commit diff
path: root/stdlib/setenv.c
Commit message (Collapse)AuthorAgeFilesLines
* setenv fix memory leak when setting large, duplicate string (BZ #17658)Eric Biggers2015-01-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc maintains a binary tree of environment strings it malloc()ed itself. However, it's possible for it to malloc() a string, then find that an identical string is already in the tree. In this case, the memory is leaked and is not freed if the application later calls __libc_freeres(). Fix this by freeing 'new_value' when it's unneeded. Test case: #include <stdlib.h> #include <string.h> int main() { char *p = calloc(100000, 1); memset(p, 'A', 99999); setenv("TESTVAR", p, 1); setenv("TESTVAR", p, 1); free(p); } Leak that was reported by valgrind: 100,008 bytes in 1 blocks are definitely lost in loss record 1 of 1 at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E6B3D4: __add_to_environ (setenv.c:176) by 0x4C31B8F: setenv (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x400642: main (in /mnt/tmpfs/a.out)
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Remove unused variable from stdlib/setenv.cOndřej Bílka2014-02-111-1/+0
|
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-101-3/+3
|
* Fix previous commit.Ondřej Bílka2014-02-101-0/+5
|
* Deduplicate setenv.Ondřej Bílka2014-02-101-72/+3
| | | | | Setenv contained a code path that was redundant as it could be handled in general case.
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Use (void) in no-arguments function definitions.Joseph Myers2013-06-081-1/+1
|
* Avoid use of "register" as optimization hint.Joseph Myers2013-06-071-2/+2
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Avoid alloca in setenv for long strings.Ulrich Drepper2010-02-021-30/+64
|
* * stdlib/setenv.c (unsetenv): Don't search environment if it doesUlrich Drepper2008-12-021-14/+15
| | | | not exist.
* Moved to csu/errno-loc.c.Ulrich Drepper2005-12-141-0/+353
|
* (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper2004-12-221-353/+0
|
* 2.5-18.1Jakub Jelinek2007-07-121-0/+353