mirror of
https://gittea.dev/nova/th.git
synced 2026-01-30 08:40:10 -05:00
-fsanitize=address related compiler assisted debugging
This commit is contained in:
1
dir.c
1
dir.c
@@ -315,6 +315,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
} else {
|
} else {
|
||||||
wattroff(win, COLOR_PAIR(dir_content[i].color_pair));
|
wattroff(win, COLOR_PAIR(dir_content[i].color_pair));
|
||||||
}
|
}
|
||||||
|
free(file_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
free(bg);
|
free(bg);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ char* get_mimetype(char *path){
|
|||||||
FILE *cmd_open = popen(cmd, "r");
|
FILE *cmd_open = popen(cmd, "r");
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
free(cmd);
|
||||||
if (getline(&line, &size, cmd_open) != -1){
|
if (getline(&line, &size, cmd_open) != -1){
|
||||||
pclose(cmd_open);
|
pclose(cmd_open);
|
||||||
return line;
|
return line;
|
||||||
|
|||||||
1
main.c
1
main.c
@@ -91,6 +91,7 @@ int main(){
|
|||||||
temp_heigth = terminal_height;
|
temp_heigth = terminal_height;
|
||||||
}
|
}
|
||||||
if (status & STATUS_RUN_BACKEND) {
|
if (status & STATUS_RUN_BACKEND) {
|
||||||
|
free(global_path);
|
||||||
global_path = getcwd(NULL, 0);
|
global_path = getcwd(NULL, 0);
|
||||||
pthread_cond_signal(&cond_top);
|
pthread_cond_signal(&cond_top);
|
||||||
pthread_cond_signal(&cond_mid);
|
pthread_cond_signal(&cond_mid);
|
||||||
|
|||||||
38
threading.c
38
threading.c
@@ -165,9 +165,7 @@ void *thread_rgt(){
|
|||||||
path = malloc(sizeof(char));
|
path = malloc(sizeof(char));
|
||||||
path[0] = '\0';
|
path[0] = '\0';
|
||||||
}
|
}
|
||||||
file_current.file_type = mid_content[selected_file_current].file_type;
|
memcpy(&file_current, &mid_content[selected_file_current], sizeof(file));
|
||||||
file_current.file_size = mid_content[selected_file_current].file_size;
|
|
||||||
file_current.status = mid_content[selected_file_current].status;
|
|
||||||
pthread_mutex_unlock(&mutex_mid);
|
pthread_mutex_unlock(&mutex_mid);
|
||||||
|
|
||||||
if (mid_content[selected_file_current].permissions & S_IRUSR) {
|
if (mid_content[selected_file_current].permissions & S_IRUSR) {
|
||||||
@@ -185,14 +183,20 @@ void *thread_rgt(){
|
|||||||
free(rgt_content);
|
free(rgt_content);
|
||||||
|
|
||||||
rgt_file_count = get_dir_size(path);
|
rgt_file_count = get_dir_size(path);
|
||||||
rgt_content = malloc(rgt_file_count * sizeof(file));
|
if (rgt_file_count) { /* fails if dir empty */
|
||||||
memset(rgt_content, '\0', rgt_file_count * sizeof(file));
|
rgt_content = malloc(rgt_file_count * sizeof(file));
|
||||||
get_dir_content(path, &rgt_file_count, rgt_content);
|
memset(rgt_content, '\0', rgt_file_count * sizeof(file));
|
||||||
rgt_content[0].status &= ~FILE_STATUS_FILE_OPEN;
|
get_dir_content(path, &rgt_file_count, rgt_content);
|
||||||
|
rgt_content[0].status &= ~FILE_STATUS_FILE_OPEN;
|
||||||
|
|
||||||
free(rgt_buffer);
|
free(rgt_buffer);
|
||||||
rgt_buffer = malloc(sizeof(char));
|
rgt_buffer = malloc(sizeof(char));
|
||||||
rgt_buffer[0] = '\0';
|
rgt_buffer[0] = '\0';
|
||||||
|
} else { /* the hovered dir is empty */
|
||||||
|
rgt_content = malloc(sizeof(file));
|
||||||
|
rgt_content->file_type = 0;
|
||||||
|
rgt_content->permissions = mid_content[selected_file_current].permissions;
|
||||||
|
}
|
||||||
} else if ((status & STATUS_DELTA_TIME) != STATUS_DELTA_TIME) {
|
} else if ((status & STATUS_DELTA_TIME) != STATUS_DELTA_TIME) {
|
||||||
|
|
||||||
unsigned long i = 0;
|
unsigned long i = 0;
|
||||||
@@ -282,6 +286,9 @@ void *thread_btm(){
|
|||||||
|
|
||||||
free(ui_btm_right_block);
|
free(ui_btm_right_block);
|
||||||
|
|
||||||
|
if(path) {
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
path = getcwd(NULL, 0);
|
path = getcwd(NULL, 0);
|
||||||
struct statvfs fs;
|
struct statvfs fs;
|
||||||
statvfs(path, &fs);
|
statvfs(path, &fs);
|
||||||
@@ -338,10 +345,9 @@ void *thread_btm(){
|
|||||||
if (buffer_width != terminal_width) {
|
if (buffer_width != terminal_width) {
|
||||||
buffer_width = terminal_width;
|
buffer_width = terminal_width;
|
||||||
free(btm_buffer);
|
free(btm_buffer);
|
||||||
btm_buffer = malloc(buffer_width);
|
btm_buffer = malloc(buffer_width+1);
|
||||||
memset(btm_buffer, ' ', buffer_width/2);
|
|
||||||
}
|
}
|
||||||
memset(btm_buffer + (buffer_width/2), ' ', buffer_width/2);
|
memset(btm_buffer, ' ', buffer_width);
|
||||||
btm_buffer[buffer_width] = '\0';
|
btm_buffer[buffer_width] = '\0';
|
||||||
|
|
||||||
memcpy(btm_buffer + buffer_width - ui_btm_right_block_size, ui_btm_right_block, ui_btm_right_block_size);
|
memcpy(btm_buffer + buffer_width - ui_btm_right_block_size, ui_btm_right_block, ui_btm_right_block_size);
|
||||||
@@ -379,13 +385,11 @@ void threading_init(){
|
|||||||
|
|
||||||
mid_content->file_type = 0;
|
mid_content->file_type = 0;
|
||||||
mid_content->file_size = 0;
|
mid_content->file_size = 0;
|
||||||
mid_content->file_name = malloc(sizeof(char));
|
mid_content->file_name = "";
|
||||||
mid_content->file_name[0] = '\0';
|
|
||||||
|
|
||||||
rgt_content->file_type = 0;
|
rgt_content->file_type = 0;
|
||||||
rgt_content->file_size = 0;
|
rgt_content->file_size = 0;
|
||||||
rgt_content->file_name = malloc(sizeof(char));
|
rgt_content->file_name = "";
|
||||||
rgt_content->file_name[0] = '\0';
|
|
||||||
|
|
||||||
|
|
||||||
volatile char vol; /* needed to make sure higher optimization steps dont move these around */
|
volatile char vol; /* needed to make sure higher optimization steps dont move these around */
|
||||||
|
|||||||
Reference in New Issue
Block a user