* FUNCTION * * FreeState Free memory associated with a struct state. * * SYNOPSIS * * static void FreeState (state) * struct state *state; * int free_state; * * DESCRIPTION * * Deallocates the memory allocated for various information in a * state. If free_state is set, also free 'state' * */
| 1757 | * |
| 1758 | */ |
| 1759 | static void FreeState(CODE_STATE *cs, struct settings *state, int free_state) |
| 1760 | { |
| 1761 | if (!is_shared(state, keywords)) |
| 1762 | FreeList(state->keywords); |
| 1763 | if (!is_shared(state, functions)) |
| 1764 | FreeList(state->functions); |
| 1765 | if (!is_shared(state, processes)) |
| 1766 | FreeList(state->processes); |
| 1767 | if (!is_shared(state, p_functions)) |
| 1768 | FreeList(state->p_functions); |
| 1769 | |
| 1770 | if (!is_shared(state, out_file)) |
| 1771 | DBUGCloseFile(cs, state->out_file); |
| 1772 | else |
| 1773 | (void) fflush(state->out_file); |
| 1774 | |
| 1775 | if (!is_shared(state, prof_file)) |
| 1776 | DBUGCloseFile(cs, state->prof_file); |
| 1777 | else |
| 1778 | (void) fflush(state->prof_file); |
| 1779 | |
| 1780 | if (free_state) |
| 1781 | free((void*) state); |
| 1782 | } |
| 1783 | |
| 1784 | |
| 1785 | /* |
no test coverage detected