Skip to content

Commit

Permalink
- last resort fixes for the memory_pool.c (to get the fmi not to cras…
Browse files Browse the repository at this point in the history
…h when calling stuff from the generated dll).

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10507 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 15, 2011
1 parent 61d7295 commit 1c702b4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions c_runtime/memory_pool.c
Expand Up @@ -66,13 +66,21 @@ void* push_memory_states(int maxThreads)

void pop_memory_states(void* new_states)
{
free(current_states[0].buffer); /* TODO: Free all of them... */
free(current_states);
if (current_states)
{
free(current_states[0].buffer); /* TODO: Free all of them... */
free(current_states);
}
current_states = new_states;
}

state get_memory_state()
{
if (!current_states)
{
push_memory_states(1);
}

return current_states[0].current_state;
}

Expand All @@ -93,6 +101,10 @@ void print_state(state s)

void restore_memory_state(state restore_state)
{
if (!current_states)
{
push_memory_states(1);
}
current_states[0].current_state = restore_state;
}

Expand Down

0 comments on commit 1c702b4

Please sign in to comment.