diff options
Diffstat (limited to 'tcc.c')
| -rw-r--r-- | tcc.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -222,6 +222,7 @@ typedef struct Section { typedef struct DLLReference { int level; + void *handle; char name[1]; } DLLReference; @@ -9486,8 +9487,6 @@ static void preprocess_init(TCCState *s1) vtop = vstack - 1; s1->pack_stack[0] = 0; s1->pack_stack_ptr = s1->pack_stack; - - macro_ptr = NULL; } /* compile the C file opened in 'file'. Return non zero if errors. */ @@ -10095,6 +10094,8 @@ static void tcc_cleanup(void) cstr_free(&tokcstr); /* reset symbol stack */ sym_free_first = NULL; + /* cleanup from error/setjmp */ + macro_ptr = NULL; } TCCState *tcc_new(void) @@ -10227,6 +10228,14 @@ void tcc_delete(TCCState *s1) for(i = 1; i < s1->nb_sections; i++) free_section(s1->sections[i]); tcc_free(s1->sections); + + /* free any loaded DLLs */ + for ( i = 0; i < s1->nb_loaded_dlls; i++) + { + DLLReference *ref = s1->loaded_dlls[i]; + if ( ref->handle ) + dlclose(ref->handle); + } /* free loaded dlls array */ dynarray_reset(&s1->loaded_dlls, &s1->nb_loaded_dlls); |
