Browse Source

[2202] Avoid delete in different thread

Michal 'vorner' Vaner 12 years ago
parent
commit
936498565a
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/lib/util/threads/tests/thread_unittest.cc

+ 3 - 5
src/lib/util/threads/tests/thread_unittest.cc

@@ -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));
     }
 }