| tar: check if allocation failed - sbase - suckless unix tools | |
| git clone git://git.suckless.org/sbase | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit 61be841f5cc4019890c769cec33744616614ea10 | |
| parent 3d8481f01dc9f579666a15a5d510358fe50cbecf | |
| Author: Hiltjo Posthuma <[email protected]> | |
| Date: Sat, 17 Jul 2021 21:04:04 +0200 | |
| tar: check if allocation failed | |
| Diffstat: | |
| M tar.c | 4 ++-- | |
| 1 file changed, 2 insertions(+), 2 deletions(-) | |
| --- | |
| diff --git a/tar.c b/tar.c | |
| @@ -78,8 +78,8 @@ static const char *filtertools[] = { | |
| static void | |
| pushdirtime(char *name, time_t mtime) | |
| { | |
| - dirtimes = reallocarray(dirtimes, dirtimeslen + 1, sizeof(*dirtimes)); | |
| - dirtimes[dirtimeslen].name = strdup(name); | |
| + dirtimes = ereallocarray(dirtimes, dirtimeslen + 1, sizeof(*dirtimes)); | |
| + dirtimes[dirtimeslen].name = estrdup(name); | |
| dirtimes[dirtimeslen].mtime = mtime; | |
| dirtimeslen++; | |
| } |