mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-25 05:27:12 +02:00
42401: workaround for gcc -foptimize-strlen oddit.
Use realloc(NULL, ...) instead of malloc in zsh-mem calloc().
This commit is contained in:
parent
ba7de6d0d5
commit
14743c0dfd
@ -1,5 +1,8 @@
|
||||
2018-02-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* Joey Pabalinas: 42401: Src/mem.c: replace malloc with use of
|
||||
realloc to work around crash with gcc using -foptimize-strlen.
|
||||
|
||||
* users/23169: Completion/Base/Completer/_expand: treat ~[...]
|
||||
the same way is other forms of tilde expansion: only expand
|
||||
if accept-exact is set.
|
||||
|
@ -1719,7 +1719,13 @@ calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
|
||||
if (!(l = n * size))
|
||||
return (MALLOC_RET_T) m_high;
|
||||
|
||||
r = malloc(l);
|
||||
/*
|
||||
* use realloc() (with a NULL `p` argument it behaves exactly the same
|
||||
* as malloc() does) to prevent an infinite loop caused by sibling-call
|
||||
* optimizations (the malloc() call would otherwise be replaced by an
|
||||
* unconditional branch back to line 1719 ad infinitum).
|
||||
*/
|
||||
r = realloc(NULL, l);
|
||||
|
||||
memset(r, 0, l);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user