From: Martin Willi Date: Wed, 10 Jul 2013 15:16:49 +0000 (+0200) Subject: leak-detective: set_state() only affects the calling thread X-Git-Tag: 5.1.0rc1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82d0317be6ed6941e3863bf45b9d5d1f8245c567;p=thirdparty%2Fstrongswan.git leak-detective: set_state() only affects the calling thread The only user (bfd backtraces) is fine with that, and we really should not mess the enable flag while doing allocations with other threads. --- diff --git a/src/libstrongswan/utils/leak_detective.c b/src/libstrongswan/utils/leak_detective.c index b2c644ae13..40c429c715 100644 --- a/src/libstrongswan/utils/leak_detective.c +++ b/src/libstrongswan/utils/leak_detective.c @@ -709,19 +709,7 @@ METHOD(leak_detective_t, leaks, int, METHOD(leak_detective_t, set_state, bool, private_leak_detective_t *this, bool enable) { - if (enable == enabled) - { - return enabled; - } - if (enable) - { - enable_leak_detective(); - } - else - { - disable_leak_detective(); - } - return !enabled; + return enable_thread(enable); } METHOD(leak_detective_t, usage, void, diff --git a/src/libstrongswan/utils/leak_detective.h b/src/libstrongswan/utils/leak_detective.h index 6a39aef067..7a29e81d79 100644 --- a/src/libstrongswan/utils/leak_detective.h +++ b/src/libstrongswan/utils/leak_detective.h @@ -57,7 +57,7 @@ struct leak_detective_t { void (*usage)(leak_detective_t *this, FILE *out); /** - * Enable/disable leak detective hooks. + * Enable/disable leak detective hooks for the current thread. * * @param TRUE to enable, FALSE to disable * @return state active before calling set_state @@ -76,4 +76,3 @@ struct leak_detective_t { leak_detective_t *leak_detective_create(); #endif /** LEAK_DETECTIVE_H_ @}*/ -