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