summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.c b/main.c
index 28f0677..7ed0cee 100644
--- a/main.c
+++ b/main.c
@@ -103,7 +103,9 @@ int main(void) {
if (strcmp(new_input.com, "ls") == 0) {
ls(new_input.arg);
free(new_input.com);
- free(new_input.arg);
+ if (new_input.arg != NULL) {
+ free(new_input.arg);
+ }
}
if (strcmp(new_input.com, "echo") == 0) {
printf("%s", new_input.arg);