THDVAR(thd, loc_info) can return NULL if the plugin was previously uninstalled. get_loc_info() and its callers dereferenced it. Guard against a NULL loc_info in get_loc_info(), auditing() and log_current_query(). Such a session is not audited.