Skip to content
Snippets Groups Projects
Commit f4e04ee7 authored by deuce's avatar deuce
Browse files

Fix use of current in load_bbslist()

Previously resulted in keeping a pointer across a free() and (hopefully)
a new malloc().  Obviously broken.

Tnaks deathr0w-!
parent 70929bbb
Branches
Tags
No related merge requests found
...@@ -1452,6 +1452,8 @@ void load_bbslist(struct bbslist **list, size_t listsize, struct bbslist *defaul ...@@ -1452,6 +1452,8 @@ void load_bbslist(struct bbslist **list, size_t listsize, struct bbslist *defaul
if(stricmp(shared_list, listpath)) /* don't read the same list twice */ if(stricmp(shared_list, listpath)) /* don't read the same list twice */
read_list(shared_list, list, defaults, listcount, SYSTEM_BBSLIST); read_list(shared_list, list, defaults, listcount, SYSTEM_BBSLIST);
sort_list(list, listcount, cur, bar, current); sort_list(list, listcount, cur, bar, current);
if(current)
free(current);
} }
/* /*
...@@ -1503,7 +1505,7 @@ struct bbslist *show_bbslist(char *current, int connected) ...@@ -1503,7 +1505,7 @@ struct bbslist *show_bbslist(char *current, int connected)
get_syncterm_filename(listpath, sizeof(listpath), SYNCTERM_PATH_LIST, FALSE); get_syncterm_filename(listpath, sizeof(listpath), SYNCTERM_PATH_LIST, FALSE);
get_syncterm_filename(shared_list, sizeof(shared_list), SYNCTERM_PATH_LIST, TRUE); get_syncterm_filename(shared_list, sizeof(shared_list), SYNCTERM_PATH_LIST, TRUE);
load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, current); load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, current?strdup(current):NULL);
uifc.helpbuf="Help Button Hack"; uifc.helpbuf="Help Button Hack";
uifc.list(WIN_T2B|WIN_RHT|WIN_EXTKEYS|WIN_DYN|WIN_HLP|WIN_ACT|WIN_INACT uifc.list(WIN_T2B|WIN_RHT|WIN_EXTKEYS|WIN_DYN|WIN_HLP|WIN_ACT|WIN_INACT
...@@ -1688,7 +1690,7 @@ struct bbslist *show_bbslist(char *current, int connected) ...@@ -1688,7 +1690,7 @@ struct bbslist *show_bbslist(char *current, int connected)
} }
else { else {
add_bbs(listpath,list[listcount-1]); add_bbs(listpath,list[listcount-1]);
load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, list[listcount-1]->name); load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, list[listcount-1]?strdup(list[listcount-1]->name):NULL);
oldopt=-1; oldopt=-1;
} }
break; break;
...@@ -1739,7 +1741,7 @@ struct bbslist *show_bbslist(char *current, int connected) ...@@ -1739,7 +1741,7 @@ struct bbslist *show_bbslist(char *current, int connected)
break; break;
} }
if(edit_list(list, list[opt],listpath,FALSE)) { if(edit_list(list, list[opt],listpath,FALSE)) {
load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, list[opt]?list[opt]->name:NULL); load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, list[opt]?strdup(list[opt]->name):NULL);
oldopt=-1; oldopt=-1;
} }
break; break;
...@@ -1754,7 +1756,7 @@ struct bbslist *show_bbslist(char *current, int connected) ...@@ -1754,7 +1756,7 @@ struct bbslist *show_bbslist(char *current, int connected)
uifc.msg("Cannot edit list in safe mode"); uifc.msg("Cannot edit list in safe mode");
} }
else if(edit_list(list, list[opt],listpath,FALSE)) { else if(edit_list(list, list[opt],listpath,FALSE)) {
load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, list[opt]?list[opt]->name:NULL); load_bbslist(list, sizeof(list), &defaults, listpath, sizeof(listpath), shared_list, sizeof(shared_list), &listcount, &opt, &bar, list[opt]?strdup(list[opt]->name):NULL);
oldopt=-1; oldopt=-1;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment