device: do not attach finalizer to non-returned object

Before, the code attached a finalizer to an object that wasn't returned,
resulting in immediate garbage collection. Instead return the actual
pointer.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2021-02-09 15:09:50 +01:00
parent 4b5d15ec2b
commit 6ac1240821
5 changed files with 22 additions and 20 deletions

View File

@@ -80,4 +80,4 @@ func BenchmarkWaitPool(b *testing.B) {
}()
}
wg.Wait()
}
}