numaffected = (inst->module->sql_affected_rows)(handle, inst->config);
if (numaffected < 1) {
RDEBUG("SQL query affected no rows");
+ (inst->driver->sql_finish_query)(handle, inst->config);
goto finish;
}
if (rcode != RLM_SQL_OK) goto query_error;
rcode = rlm_sql_fetch_row(inst, request, &handle);
- if (rcode) goto query_error;
+ if (rcode) {
+ (inst->driver->sql_finish_select_query)(handle, inst->config);
+ goto query_error;
+ }
row = handle->row;
if (!row) {
fr_pair_value_strsteal(vp, expanded);
RDEBUG2("SQL-User-Name set to '%s'", vp->vp_strvalue);
- vp->op = T_OP_SET;
+ vp->op = T_OP_SET;
/*
* Delete any existing SQL-User-Name, and replace it with ours.
*
* We need this to check if the sql_fields callback is provided.
*/
- inst->handle = lt_dlopenext(inst->config->sql_driver_name);
+ inst->handle = fr_dlopenext(inst->config->sql_driver_name);
if (!inst->handle) {
ERROR("Could not link driver %s: %s", inst->config->sql_driver_name, fr_strerror());
ERROR("Make sure it (and all its dependent libraries!) are in the search path of your system's ld");