From e9b5543bd503ffebbd7fc4b5328d8a9c69419908 Mon Sep 17 00:00:00 2001 From: flywind Date: Wed, 17 Mar 2021 17:08:54 +0800 Subject: [std/channels]fix recv leaks(Part One) (#17394) --- tests/stdlib/tchannels_pthread.nim | 3 ++- tests/stdlib/tchannels_simple.nim | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/stdlib/tchannels_pthread.nim b/tests/stdlib/tchannels_pthread.nim index a9708d8fb..3bc000551 100644 --- a/tests/stdlib/tchannels_pthread.nim +++ b/tests/stdlib/tchannels_pthread.nim @@ -89,6 +89,7 @@ proc runSuite( capacity(chan) == 1 isBuffered(chan) == false isUnbuffered(chan) == true + else: chan = allocChannel(size = int.sizeof.int, n = 7) check: @@ -109,7 +110,7 @@ proc runSuite( discard pthread_join(threads[0], nil) discard pthread_join(threads[1], nil) - freeChannel(chan) + freeChannel(chan) # ---------------------------------------------------------------------------------- diff --git a/tests/stdlib/tchannels_simple.nim b/tests/stdlib/tchannels_simple.nim index dc4857c3e..56e5fb8f1 100644 --- a/tests/stdlib/tchannels_simple.nim +++ b/tests/stdlib/tchannels_simple.nim @@ -24,8 +24,7 @@ var worker1: Thread[void] createThread(worker1, firstWorker) # Block until the message arrives, then print it out. -var dest = "" -chan.recv(dest) +let dest = chan.recv() doAssert dest == "Hello World!" # Wait for the thread to exit before moving on to the next example. -- cgit 1.4.1-2-gfad0