mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-01 02:32:49 -04:00
selftests: net: fix memory leak in tls.c
To free memory and close fd after use Suggested-by: Jun Zhan <zhanjun@uniontech.com> Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com> Link: https://patch.msgid.link/20250819-memoryleak-v1-1-d4c70a861e62@uniontech.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
07cf71bf25
commit
e5b71dd3ad
@@ -427,6 +427,8 @@ TEST_F(tls, sendfile)
|
||||
EXPECT_GE(filefd, 0);
|
||||
fstat(filefd, &st);
|
||||
EXPECT_GE(sendfile(self->fd, filefd, 0, st.st_size), 0);
|
||||
|
||||
close(filefd);
|
||||
}
|
||||
|
||||
TEST_F(tls, send_then_sendfile)
|
||||
@@ -448,6 +450,9 @@ TEST_F(tls, send_then_sendfile)
|
||||
|
||||
EXPECT_GE(sendfile(self->fd, filefd, 0, st.st_size), 0);
|
||||
EXPECT_EQ(recv(self->cfd, buf, st.st_size, MSG_WAITALL), st.st_size);
|
||||
|
||||
free(buf);
|
||||
close(filefd);
|
||||
}
|
||||
|
||||
static void chunked_sendfile(struct __test_metadata *_metadata,
|
||||
|
||||
Reference in New Issue
Block a user