From: Nick Porter Date: Fri, 28 Jun 2024 09:43:12 +0000 (+0100) Subject: Always mark trunk requests as complete when freeing query ctx X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73d916f477100c72da54b1f689f77c1674e01d7e;p=thirdparty%2Ffreeradius-server.git Always mark trunk requests as complete when freeing query ctx Due to query_ctx being re-used multiple times when running transactions (e.g. allocating IPs in sqlippool) it is possible for the current query to not be submitted, but there still to be a trunk request associated with the query_ctx. --- diff --git a/src/modules/rlm_sql/sql.c b/src/modules/rlm_sql/sql.c index 90ae00886a4..15239ca8c48 100644 --- a/src/modules/rlm_sql/sql.c +++ b/src/modules/rlm_sql/sql.c @@ -396,11 +396,12 @@ void rlm_sql_print_error(rlm_sql_t const *inst, request_t *request, fr_sql_query */ static int fr_sql_query_free(fr_sql_query_t *to_free) { - if (to_free->status <= 0) return 0; - if (to_free->type == SQL_QUERY_SELECT) { - (to_free->inst->driver->sql_finish_select_query)(to_free, &to_free->inst->config); - } else { - (to_free->inst->driver->sql_finish_query)(to_free, &to_free->inst->config); + if (to_free->status > 0) { + if (to_free->type == SQL_QUERY_SELECT) { + (to_free->inst->driver->sql_finish_select_query)(to_free, &to_free->inst->config); + } else { + (to_free->inst->driver->sql_finish_query)(to_free, &to_free->inst->config); + } } if (to_free->treq) trunk_request_signal_complete(to_free->treq); return 0;