]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2202] Avoid delete in different thread
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 1 Oct 2012 13:25:02 +0000 (15:25 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 1 Oct 2012 13:25:02 +0000 (15:25 +0200)
src/lib/util/threads/tests/thread_unittest.cc

index 4d477ee9878ac261d57b99b0acdb97088ec27aa1..5f95d6171a9bafd7664b7726319687764de7dbc5 100644 (file)
@@ -37,16 +37,14 @@ using namespace isc::util::thread;
 namespace {
 
 void
-doSomething(int* x) {
-    delete[] x;
-}
+doSomething(int*) { }
 
 // We just test that we can forget about the thread and nothing
 // bad will happen on our side.
 TEST(ThreadTest, detached) {
+    int x;
     for (size_t i = 0; i < detached_iterations; ++i) {
-        int* x = new int[10];
-        Thread thread(boost::bind(&doSomething, x));
+        Thread thread(boost::bind(&doSomething, &x));
     }
 }