diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-03-17 23:21:05 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-03-17 23:33:23 +1300 |
commit | e03f254588353ed62887f07cd40244135af348a0 (patch) | |
tree | 44a65d1298904e9cd6b3ad3bbc8444a14ff4622f | |
parent | Move ls includes into a header (diff) | |
download | tunics-e03f254588353ed62887f07cd40244135af348a0.tar.gz tunics-e03f254588353ed62887f07cd40244135af348a0.zip |
Free memory in ls(1) too
-rw-r--r-- | ls.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -14,6 +14,7 @@ int main(int argc, char **argv) if ((dir = opendir(dirname)) == NULL) { perror("opendir"); + free(dir); exit(EXIT_FAILURE); } @@ -22,9 +23,13 @@ int main(int argc, char **argv) } if (errno) { perror("readdir"); + free(dir); + free(dirent); exit(EXIT_FAILURE); } + free(dir); + free(dirent); exit(EXIT_SUCCESS); } |