diff --git a/ccc.c b/ccc.c
index 6e0fe49..4d3b55a 100644
--- a/ccc.c
+++ b/ccc.c
@@ -220,6 +220,7 @@ void handle_sigwinch(int ignore)
 
 void cleanup(void)
 {
+	hashtable_free();
 	if (files->length != 0) {
 		arraylist_free(files);
 	}
@@ -547,6 +548,7 @@ void show_file_content(void)
 			int color = files_visit->items[i].color;
 			move_cursor(i + 1, half_width);
 			bprintf("\033[K\033[%dm%s\033[m\n", color, line);
+			free(line);
 		}
 		arraylist_free(files_visit);
 		return;
@@ -565,6 +567,7 @@ void show_file_content(void)
 			return;
 		}
 	}
+	fclose(file);
 	int pipe_fd[2];
 	if (pipe(pipe_fd) == -1) {
 		perror("pipe");
diff --git a/icons.c b/icons.c
index 82d2ca7..168a068 100644
--- a/icons.c
+++ b/icons.c
@@ -187,3 +187,9 @@ icon *hashtable_search(char *name)
     
     return NULL;
 }
+
+void hashtable_free(void)
+{
+	for (int i = 0; i < TABLE_SIZE; i++)
+        free(hash_table[i]);
+}
diff --git a/icons.h b/icons.h
index d58848b..c50042f 100644
--- a/icons.h
+++ b/icons.h
@@ -14,5 +14,6 @@ void hashtable_init(void);
 void hashtable_print(void);
 int hashtable_add(icon *p);
 icon *hashtable_search(char *name);
+void hashtable_free(void);
 
 #endif