From 23170093eefbed24c7d1310ba718819cd84e82d4 Mon Sep 17 00:00:00 2001 From: CPunch Date: Thu, 7 Dec 2023 21:37:16 -0600 Subject: [PATCH] login_test: fix minor memory leak defer PutBuffer so that the event packet is returned to the pool --- login/login_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/login/login_test.go b/login/login_test.go index 1ce9416..3125880 100644 --- a/login/login_test.go +++ b/login/login_test.go @@ -63,8 +63,9 @@ func sendAndRecv(peer *cnet.Peer, recv chan *cnet.PacketEvent, is *is.I, sID, rI // receive response evnt := <-recv - is.Equal(evnt.PktID, rID) // should receive expected type + defer protocol.PutBuffer(evnt.Pkt) + is.Equal(evnt.PktID, rID) // should receive expected type is.NoErr(protocol.NewPacket(evnt.Pkt).Decode(in)) // packet.Decode() should not return an error }