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
This commit is contained in:
Toomas Soome 2018-09-08 19:17:22 +00:00
parent fc71a66be0
commit 7ee96df3b3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338535

View File

@ -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;