fixed memory leaks

this also depricated the sent folder
This commit is contained in:
Benedikt Galbavy 2023-11-15 19:08:28 +01:00
parent 4ecd73bed9
commit 8ac543e61d
2 changed files with 11 additions and 3 deletions

View File

@ -32,7 +32,7 @@ user::user(fs::path user_data_json) : m()
this->inbox.insert(mail);
}
for ( auto& mail_json : user_data["mails"]["sent"] ) {
/*for ( auto& mail_json : user_data["mails"]["sent"] ) {
mail* mail = new struct mail(
mail_json["filename"],
mail_json["timestamp"],
@ -44,7 +44,7 @@ user::user(fs::path user_data_json) : m()
mail->deleted = mail_json["deleted"];
this->sent.insert(mail);
}
}*/
this->user_data = user_data;
this->file_location = user_data_json;
@ -66,7 +66,12 @@ user::user(std::string name, fs::path user_dir)
}
user::~user() {
for (auto& mail : this->inbox) {
delete(mail);
}
for (auto& mail : this->sent) { // depricated
delete(mail);
}
}
void user::addMail(mail* mail)

View File

@ -15,6 +15,9 @@ user_handler::user_handler() : m_user()
user_handler::~user_handler()
{
for (auto& user : this->users) {
delete(user.second);
}
//
}