From 61be841f5cc4019890c769cec33744616614ea10 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 17 Jul 2021 21:04:04 +0200 Subject: [PATCH] tar: check if allocation failed --- tar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tar.c b/tar.c index b74c134..d3a9f3b 100644 --- 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++; }