fixed some memory leaks
This commit is contained in:
@ -46,7 +46,7 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
|
||||
if (entry[i]->d_name[0] == '.' && !(file_modifiers & FILE_MODIFIERS_HIDDEN_FILES)) {
|
||||
} else {
|
||||
dir_content[i].file_name_width = strlen(entry[i]->d_name);
|
||||
dir_content[i].file_name = malloc(dir_content[i].file_name_width);
|
||||
dir_content[i].file_name = malloc(dir_content[i].file_name_width + 1);
|
||||
strcpy(dir_content[i].file_name, entry[i]->d_name);
|
||||
|
||||
struct stat *file;
|
||||
@ -127,7 +127,7 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
|
||||
void print_dir(WINDOW *win, unsigned long *line_width, unsigned long *dir_file_count, file *dir_content){
|
||||
|
||||
|
||||
char *hover_bg = malloc(*line_width);
|
||||
char *hover_bg = malloc(*line_width+1);
|
||||
memset(hover_bg, ' ', *line_width);
|
||||
hover_bg[*line_width] = '\0';
|
||||
unsigned long i = 0;
|
||||
|
Reference in New Issue
Block a user