From 8a327f6eda72d053d0725155c9b50071ddde86d1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 10 Jun 2023 15:24:53 -0500 Subject: [PATCH] Fix two uses of strdup() instead of xstrdup(). --- toys/posix/patch.c | 2 +- toys/posix/tar.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toys/posix/patch.c b/toys/posix/patch.c index 6bdd4615..a6b83985 100644 --- a/toys/posix/patch.c +++ b/toys/posix/patch.c @@ -423,7 +423,7 @@ void patch_main(void) char **which = FLAG(R) ? &oldname : &newname; free(*which); - *which = strdup(toys.optargs[0]); + *which = xstrdup(toys.optargs[0]); // The supplied path should be taken literally with or without -p. toys.optflags |= FLAG_p; TT.p = 0; diff --git a/toys/posix/tar.c b/toys/posix/tar.c index 8c2ef15e..0f9b39c0 100644 --- a/toys/posix/tar.c +++ b/toys/posix/tar.c @@ -547,7 +547,7 @@ static int dirflush(char *name, int isdir) // --restrict means first entry extracted is what everything must be under if (FLAG(restrict)) { free(TT.cwd); - TT.cwd = strdup(s); + TT.cwd = xstrdup(s); toys.optflags ^= FLAG_restrict; } // use resolved name so trailing / is stripped -- 2.39.2