]> gitweb.hhaalo.de Git - mv_none_space.git/commitdiff
is dir no malloc
authorBastian Dehn <hhaalo@arcor.de>
Sat, 28 Feb 2026 14:39:57 +0000 (15:39 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 28 Feb 2026 14:39:57 +0000 (15:39 +0100)
src/main.c

index a33ca0a6db9556b78e8fa91c5deeb941f80be6ce..6516cd030011c3fd8b750f2391771036a2f5bbb1 100644 (file)
@@ -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;
 }