diff --git a/dpi/file.cc b/dpi/file.cc index 59dcafc..e4f7b3d 100644 --- a/dpi/file.cc +++ b/dpi/file.cc @@ -92,6 +92,7 @@ struct DilloDir { }; struct ClientInfo { + ~ClientInfo(); Dsh *sh; std::optional< std::string > orig_url; std::optional< std::string > filename; @@ -280,14 +281,6 @@ static std::unique_ptr< DilloDir > File_dillodir_new(const std::string &dirname) return Ddir; } -/* - * Deallocate a DilloDir structure. - */ -static void File_dillodir_free(DilloDir *Ddir) -{ - delete Ddir; -} - /* * Output the string for parent directory */ @@ -914,15 +907,18 @@ static void File_remove_client(ClientInfo *client) { dList_remove(Clients, (void *)client); - _MSG("Closing Socket Handler\n"); - a_Dpip_dsh_close(client->sh); - a_Dpip_dsh_free(client->sh); - File_close(client->file_fd); - File_dillodir_free(client->d_dir); - delete client; } +ClientInfo::~ClientInfo() +{ + _MSG("Closing Socket Handler\n"); + a_Dpip_dsh_close(sh); + a_Dpip_dsh_free(sh); + File_close(file_fd); + delete d_dir; +} + /* * Serve this client. */