Fix memory leak
This commit is contained in:
parent
3c005f84f9
commit
d6f9054bc0
3 changed files with 10 additions and 0 deletions
3
ccc.c
3
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");
|
||||
|
|
6
icons.c
6
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]);
|
||||
}
|
||||
|
|
1
icons.h
1
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
|
||||
|
|
Loading…
Reference in a new issue