[Fix] Hook memleak.

This commit is contained in:
Allanis 2013-08-01 16:23:21 +01:00
parent eba65cf358
commit 34dccfb646

View File

@ -94,14 +94,17 @@ void hook_rm(unsigned int id) {
else break; else break;
} }
/* Mark to delete, but do not delete yet, hooks are running. */
if(hook_runningstack) { if(hook_runningstack) {
hook_stack[m].delete = 1; hook_stack[m].delete = 1;
return; return;
} }
/* Free the hook. */
hook_free(&hook_stack[m]);
/* Last hook, just clip the stack. */ /* Last hook, just clip the stack. */
if(m == (hook_nstack-1)) { if(m == (hook_nstack-1)) {
hook_free(&hook_stack[m]);
hook_nstack--; hook_nstack--;
return; return;
} }