commit 61be841f5cc4019890c769cec33744616614ea10
parent 3d8481f01dc9f579666a15a5d510358fe50cbecf
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 17 Jul 2021 21:04:04 +0200
tar: check if allocation failed
Diffstat:
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++;
}