updated the makefiles to take the mysql module into account

(and generalized them a bit)
don't leak keystr in the fault paths

ensure releasing it before leaving the functions where it has been created