coolxv / cpp-stub

C++ unit test stub(not mock) and awesome.Surpported ISA x86,x86-64,arm64,arm32,arm thumb,mips64,riscv,loongarch64.
MIT License
280 stars 82 forks source link

Fix the problem that repeated stub the same function will cause memory leaks #14

Closed halo-sp closed 3 years ago

halo-sp commented 3 years ago

…y leaks

Calling set twice to the same original function will cause the func_stub object created in the first set to be out of control and not released, so may need to check before inserting the map

halo-sp commented 3 years ago

I found that calling set twice to the same original function will cause memory leaks. This PR solved the problem. May you can accept.

coolxv commented 3 years ago

Thanks, bug fixed. Modify to call reset() on each set(). #13