From 7ee96df3b35f182899d6f66bb9ea513f11f7549d Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sat, 8 Sep 2018 19:17:22 +0000 Subject: [PATCH] libsa: memory leak in tftp_open() tftpfile is allocated just above and needs to be freed. Reviewed by: imp Approved by: re (kib) Differential Revision: https://reviews.freebsd.org/D17058 --- stand/libsa/tftp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index e8bde5ab7bc..e66c362f7f5 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -447,8 +447,10 @@ tftp_open(const char *path, struct open_file *f) memset(tftpfile, 0, sizeof(*tftpfile)); tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE; tftpfile->iodesc = io = socktodesc(*(int *) (f->f_devdata)); - if (io == NULL) + if (io == NULL) { + free(tftpfile); return (EINVAL); + } io->destip = servip; tftpfile->off = 0; -- 2.45.0