[Toybox] [PATCH] cpio: Guard free() with CFG_TOYBOX_FREE

Yi-Yo Chiang yochiang at google.com
Sun Feb 14 05:07:33 PST 2021


---
 toys/posix/cpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/posix/cpio.c b/toys/posix/cpio.c
index 795f890c..e8205a30 100644
--- a/toys/posix/cpio.c
+++ b/toys/posix/cpio.c
@@ -304,7 +304,7 @@ void cpio_main(void)
       free(link);
       xclose(fd);
     }
-    free(name);
+    if (CFG_TOYBOX_FREE) free(name);
 
     memset(toybuf, 0, sizeof(toybuf));
     xwrite(afd, toybuf,
-- 
2.30.0.478.g8a0d178c01-goog



More information about the Toybox mailing list