From c5fdf0c377d556f787aafc4ece046defd5050d5d Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 28 Feb 2026 15:39:57 +0100 Subject: [PATCH] is dir no malloc --- src/main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index a33ca0a..6516cd0 100644 --- a/src/main.c +++ b/src/main.c @@ -22,13 +22,10 @@ glob_t* get_files(const char* dir_path) bool is_dir(const char* path) { - struct stat* statbuf = malloc(sizeof(struct stat)); + struct stat statbuf; - stat(path, statbuf); - bool isdir = S_ISDIR(statbuf->st_mode); - - free(statbuf); - statbuf = NULL; + stat(path, &statbuf); + bool isdir = S_ISDIR(statbuf.st_mode); return isdir; } -- 2.47.3