From: Nick Porter Date: Sat, 20 May 2023 19:54:46 +0000 (+0100) Subject: Fix for CID #1529242 and improve comment about query freeing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de56a42a4fe2a18e6b45a80a0d1f1d0224cf2a12;p=thirdparty%2Ffreeradius-server.git Fix for CID #1529242 and improve comment about query freeing --- diff --git a/src/lib/ldap/connection.c b/src/lib/ldap/connection.c index dedf3cf55b3..154b68b4f7c 100644 --- a/src/lib/ldap/connection.c +++ b/src/lib/ldap/connection.c @@ -928,13 +928,18 @@ static void ldap_trunk_request_demux(fr_event_list_t *el, fr_trunk_connection_t if (query->parser) query->parser(ldap_conn->handle, query, result, query->treq->rctx); /* - * Mark the trunk request as complete and set the request as runnable + * Set the request as runnable */ - if (query->treq->request) unlang_interpret_mark_runnable(query->treq->request); + if (request) unlang_interpret_mark_runnable(request); /* - * If the query is parented off just the treq, then it will be freed when - * the request is completed. If it has other parenting, then it will not. + * If referral following failed, there is no active trunk request. + */ + if (!query->treq) continue; + + /* + * If the query is parented off the treq then it will be freed when + * the request is completed. If it is parented by something else then it will not. */ treq = query->treq; query->treq = NULL;