fix: dev: free per-command rndc state when response serialisation fails

When isccc_cc_towire failed while building an rndc reply,
control_respond returned without releasing the per-command request,
response, HMAC secret copy, and text buffer.  They were eventually
freed when the connection closed, but until then the HMAC key copy
stayed in named's memory.  The failure path now goes through the
same cleanup label as every other error.

Closes #5913

Merge branch '5913-controlconf-control-respond-cleanup-leak' into 'main'

See merge request isc-projects/bind9!11915
This commit is contained in:
Ondřej Surý 2026-04-30 09:33:00 +02:00
commit bf7ee390ba

View file

@ -354,11 +354,8 @@ control_respond(controlconnection_t *conn) {
/* Skip the length field (4 bytes) */
isc_buffer_add(conn->buffer, 4);
result = isccc_cc_towire(conn->response, &conn->buffer, conn->alg,
&conn->secret);
if (result != ISC_R_SUCCESS) {
return;
}
CHECK(isccc_cc_towire(conn->response, &conn->buffer, conn->alg,
&conn->secret));
isc_buffer_init(&b, conn->buffer->base, 4);
isc_buffer_putuint32(&b, conn->buffer->used - 4);