1
0

🔨」 fix: fixed leak when throwing

This commit is contained in:
2025-06-30 10:54:43 +02:00
parent da635ef59a
commit f8eaea321e
3 changed files with 17 additions and 8 deletions

View File

@ -6,11 +6,12 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/21 10:34:50 by adjoly #+# #+# */
/* Updated: 2025/06/03 11:31:50 by adjoly ### ########.fr */
/* Updated: 2025/06/30 10:52:15 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <BitcoinExchange.hpp>
#include <cstddef>
#include <cstdlib>
#include <exception>
#include <stdexcept>
@ -23,9 +24,11 @@ int main(int ac, char **av) {
btc = new BitcoinExchange(av[1]);
btc->print();
} catch (std::runtime_error &e) {
btc = NULL;
std::cout << e.what() << std::endl;
}
delete btc;
if (btc != NULL)
delete btc;
} else {
std::cout << "Error: could not open file." << std::endl;
}