httpkadmind: If early ENOMEM, close the connection

This commit is contained in:
Nicolas Williams
2023-01-04 16:24:55 -06:00
parent e27ddc6596
commit a13c3fc32c

View File

@@ -763,12 +763,10 @@ bad_reqv(kadmin_request_desc r,
char *formatted = NULL; char *formatted = NULL;
char *msg = NULL; char *msg = NULL;
if (r && r->context)
context = r->context; context = r->context;
if (r && r->hcontext && r->kv) if (r->hcontext && r->kv)
heim_audit_setkv_number((heim_svc_req_desc)r, "http-status-code", heim_audit_setkv_number((heim_svc_req_desc)r, "http-status-code",
http_status_code); http_status_code);
if (r)
(void) gettimeofday(&r->tv_end, NULL); (void) gettimeofday(&r->tv_end, NULL);
if (code == ENOMEM) { if (code == ENOMEM) {
if (context) if (context)
@@ -792,7 +790,7 @@ bad_reqv(kadmin_request_desc r,
msg = formatted; msg = formatted;
formatted = NULL; formatted = NULL;
} }
if (r && r->hcontext) if (r->hcontext)
heim_audit_addreason((heim_svc_req_desc)r, "%s", formatted); heim_audit_addreason((heim_svc_req_desc)r, "%s", formatted);
krb5_free_error_message(context, k5msg); krb5_free_error_message(context, k5msg);
@@ -2189,11 +2187,8 @@ route(void *cls,
* handling a POST then we'll also get called with upload_data != NULL, * handling a POST then we'll also get called with upload_data != NULL,
* possibly multiple times. * possibly multiple times.
*/ */
if ((ret = set_req_desc(connection, method, url, &r))) { if ((ret = set_req_desc(connection, method, url, &r)))
return return MHD_NO;
bad_503(r, ret, "Could not initialize request state") == -1
? MHD_NO : MHD_YES;
}
*ctx = r; *ctx = r;
/* /*