From ad598c70f90788ec785a6b3d0040e76f95ce5fa4 Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Sun, 15 Aug 2021 16:26:59 -0400 Subject: [PATCH] `ls`: fix memory leak from not freeing the directory. --- src/ls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ls.c b/src/ls.c index f0e799e..32812b0 100644 --- a/src/ls.c +++ b/src/ls.c @@ -94,6 +94,8 @@ static int listDirs(char *thatpath, bool specpath, bool colour, bool showdot, count++; } } + free(dirp); + free(dp); qsort(words, count - 1, sizeof(words), cmp); char oldwd[PATH_MAX]; strcpy(oldwd, wd);