It seems that resources are properly deallocated by MHD_destroy_response,
even if enqueuing the request fails.
Also replace a trivial printf with alloca and fixup log message
(it'll now be something like "Connection from CN=some.host.name",
which seems clear enough.)
#endif
void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
#endif
void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
- _cleanup_free_ char *f = NULL;
- if (asprintf(&f, "microhttpd: %s", fmt) <= 0) {
- log_oom();
- return;
- }
+ f = strappenda("microhttpd: ", fmt);
DISABLE_WARNING_FORMAT_NONLITERAL;
log_metav(LOG_INFO, NULL, 0, NULL, f, ap);
DISABLE_WARNING_FORMAT_NONLITERAL;
log_metav(LOG_INFO, NULL, 0, NULL, f, ap);
if (r < 0)
return respond_oom(connection);
if (r < 0)
return respond_oom(connection);
- r = mhd_respond_internal(connection, code, m, r, MHD_RESPMEM_MUST_FREE);
- if (r == MHD_NO)
- free(m);
- return r;
+ return mhd_respond_internal(connection, code, m, r, MHD_RESPMEM_MUST_FREE);
- log_info("Connection from DN %s", buf);
+ log_info("Connection from %s", buf);
r = verify_cert_authorized(session);
if (r < 0) {
r = verify_cert_authorized(session);
if (r < 0) {