]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
leak-detective: set_state() only affects the calling thread
authorMartin Willi <martin@revosec.ch>
Wed, 10 Jul 2013 15:16:49 +0000 (17:16 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 10 Jul 2013 15:28:32 +0000 (17:28 +0200)
The only user (bfd backtraces) is fine with that, and we really should not
mess the enable flag while doing allocations with other threads.

src/libstrongswan/utils/leak_detective.c
src/libstrongswan/utils/leak_detective.h

index b2c644ae13e45d902e7f6363ddabd1a0a2121665..40c429c7153a70fce6a9686ae27b579d51c85fd6 100644 (file)
@@ -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,
index 6a39aef067f188d62b881f07c814aff2b1c7c1ca..7a29e81d793294bdb399be3649e4c9867f5ece00 100644 (file)
@@ -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_ @}*/
-