Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Sep 2018 19:17:22 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338535 - head/stand/libsa
Message-ID:  <201809081917.w88JHMii045988@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809081917.w88JHMii045988>