MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / FreeState

Function FreeState

dbug/dbug.c:1759–1782  ·  view source on GitHub ↗

* 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' * */

Source from the content-addressed store, hash-verified

1757 *
1758 */
1759static 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/*

Callers 3

DbugParseFunction · 0.85
_db_pop_Function · 0.85
_db_end_Function · 0.85

Calls 2

FreeListFunction · 0.85
DBUGCloseFileFunction · 0.85

Tested by

no test coverage detected