「🔨」 fix: fixed leak when throwing
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user