memory leaks fixing

This commit is contained in:
2020-05-31 19:24:35 +02:00
parent b8659268cc
commit 3387aa7ca1
11 changed files with 87 additions and 34 deletions

View File

@@ -29,7 +29,6 @@ void conexion_ssl::start_server(){
perror("bad port in config file");
}
sock = this->create_socket(atoi(port.data()));
/* Handle connections */
SSL_CTX *ctx;
init_openssl();
@@ -37,8 +36,6 @@ void conexion_ssl::start_server(){
this->configure_context(ctx);
//std::thread *hilos=new thread[50];
//int cont=0;
while(1) {
struct sockaddr_in addr;
uint len = sizeof(addr);
@@ -46,7 +43,6 @@ void conexion_ssl::start_server(){
int client = accept(sock, (struct sockaddr*)&addr, &len);
std::thread t_client(conexion_client,ctx , client);
t_client.detach();
//cont++;
}
close(sock);
SSL_CTX_free(ctx);
@@ -107,8 +103,6 @@ void conexion_ssl::configure_context(SSL_CTX *ctx)
}
void conexion_client(SSL_CTX *ctx,int client){
char buf [256];
if (client < 0) {
perror("Unable to accept");
exit(EXIT_FAILURE);
@@ -122,9 +116,13 @@ void conexion_client(SSL_CTX *ctx,int client){
}
else {
session_manager* session = new session_manager_ssl(ssl);
while(!session->validate_pass());
session->start_dialog();
//SSL_write(ssl,std::to_string(la->execute()).data() , sizeof (int));
bool enter=session->validate_pass();
while(!enter){
enter=session->validate_pass();
}
if(enter){
session->start_dialog();
}
delete (session);
}
SSL_shutdown(ssl);