Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
seh exception in constructor memory leak
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> #include <windows.h> struct some_class { void *p; some_class() { std::cout << "some_class::some_class() begin" << std::endl; p = malloc(1000); // generate asyncronous exception *(int*)0 = 0; std::cout << "some_class::some_class() end" << std::endl; } ~some_class() { std::cout << "some_class::~some_class() begin" << std::endl; free(p); std::cout << "some_class::~some_class() end" << std::endl; } }; void some_func() { some_class x; } int main() { std::cout << "starting" << std::endl; __try { some_func(); } __except( EXCEPTION_EXECUTE_HANDLER ) { std::cout << "EXCEPTION_EXECUTE_HANDLER" << std::endl; } std::cout << "exiting" << std::endl; }
run
|
edit
|
history
|
help
0
Dices by GOOSE
error_check
Default constructor - deleted
Computing factorial of an integer with recursion and iteration
hgh
VS struct name enumerate
div64 inline asm
hangman
new
Hangman