svn commit: r338535 - head/stand/libsa

Toomas Soome tsoome at FreeBSD.org
Sat Sep 8 19:17:23 UTC 2018


Author: tsoome
Date: Sat Sep  8 19:17:22 2018
New Revision: 338535
URL: https://svnweb.freebsd.org/changeset/base/338535

Log:
  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

Modified:
  head/stand/libsa/tftp.c

Modified: head/stand/libsa/tftp.c
==============================================================================
--- head/stand/libsa/tftp.c	Sat Sep  8 18:57:29 2018	(r338534)
+++ head/stand/libsa/tftp.c	Sat Sep  8 19:17:22 2018	(r338535)
@@ -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;


More information about the svn-src-head mailing list