commit 63893474befccbed7a69e2738a48267d4a6652e2
parent 2e5d0e9de9f3861d2bb094d20e94e5a66b70ba7f
Author: phoebos <ben@bvnf.space>
Date: Fri, 24 Sep 2021 18:43:18 +0100
ls: free(dp) which is alloc'd by scandir(3)
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/ls.c b/ls.c
@@ -2,6 +2,7 @@
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -83,6 +84,7 @@ ls(const char *path, int flags) {
printname(&e, flags);
}
close(dfd);
+ free(dp);
} else {
/* file */
struct ent e = { .name = path, .mode = st.st_mode };