Fri, 20 Sep 2024 20:04:35 +0200
fix trace log use after free
src/server/daemon/sessionhandler.c | file | annotate | diff | comparison | revisions |
--- a/src/server/daemon/sessionhandler.c Thu Sep 19 22:17:24 2024 +0200 +++ b/src/server/daemon/sessionhandler.c Fri Sep 20 20:04:35 2024 +0200 @@ -279,10 +279,10 @@ EventHttpIO *io = evt_req_init(handler, conn); if(!io) { log_ereport(LOG_DEBUG, "trace reqid: %016llx connection destroyed | evt_req_init failed", (unsigned long long int)conn->id); + log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)conn->id); connection_destroy(conn); free(start_request); free(event); - log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)conn->id); return; } @@ -522,6 +522,7 @@ HTTPRequest *request = io->request; log_ereport(LOG_DEBUG, "trace reqid: %016llx request finish", (unsigned long long int)request->connection->id); + uint64_t reqid = request->connection->id; // remove timeout if(io->watch.intdata) { @@ -547,7 +548,7 @@ free(io); free(event); - log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)request->connection->id); + log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)reqid); return 0; } @@ -556,6 +557,7 @@ EventHttpIO *io = event->cookie; HttpParser *parser = io->parser; HTTPRequest *request = io->request; + uint64_t reqid = request->connection->id; log_ereport(LOG_DEBUG, "trace reqid: %016llx request error", (unsigned long long int)request->connection->id); @@ -578,7 +580,7 @@ free(io); free(event); - log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)request->connection->id); + log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)reqid); return 0; }