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

Allow NULL for cterm at exit...

parent 0e93d967
No related branches found
No related tags found
No related merge requests found
......@@ -2538,26 +2538,28 @@ void cterm_end(struct cterminal *cterm)
{
int i;
cterm_closelog(cterm);
if(cterm) {
cterm_closelog(cterm);
#ifdef CTERM_WITHOUT_CONIO
FREE_AND_NULL(BD->vmem);
FREE_AND_NULL(BD);
FREE_AND_NULL(BD->vmem);
FREE_AND_NULL(BD);
#else
for(i=CONIO_FIRST_FREE_FONT; i < 256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
}
for(i=CONIO_FIRST_FREE_FONT; i < 256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
}
#endif
if(cterm->playnote_thread_running) {
if(sem_trywait(&cterm->playnote_thread_terminated)==-1) {
listSemPost(&cterm->notes);
sem_wait(&cterm->playnote_thread_terminated);
if(cterm->playnote_thread_running) {
if(sem_trywait(&cterm->playnote_thread_terminated)==-1) {
listSemPost(&cterm->notes);
sem_wait(&cterm->playnote_thread_terminated);
}
sem_destroy(&cterm->playnote_thread_terminated);
sem_destroy(&cterm->note_completed_sem);
listFree(&cterm->notes);
}
sem_destroy(&cterm->playnote_thread_terminated);
sem_destroy(&cterm->note_completed_sem);
listFree(&cterm->notes);
free(cterm);
}
free(cterm);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment