Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Sep 2017 12:15:13 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324014 - head/usr.sbin/mountd
Message-ID:  <201709261215.v8QCFDg2030810@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Tue Sep 26 12:15:13 2017
New Revision: 324014
URL: https://svnweb.freebsd.org/changeset/base/324014

Log:
  mountd: Avoid memory leak by freeing dp_dirp
  
  Introduced in r324007, the data alloced by strdup was never free'ed.
  While here, remove cast to caddr_t when freeing dp.
  
  Reported by:	bde
  MFC after:	1 week
  X MFC With:	r324007

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==============================================================================
--- head/usr.sbin/mountd/mountd.c	Tue Sep 26 11:16:33 2017	(r324013)
+++ head/usr.sbin/mountd/mountd.c	Tue Sep 26 12:15:13 2017	(r324014)
@@ -2159,7 +2159,8 @@ free_dir(struct dirlist *dp)
 		free_dir(dp->dp_left);
 		free_dir(dp->dp_right);
 		free_host(dp->dp_hosts);
-		free((caddr_t)dp);
+		free(dp->dp_dirp);
+		free(dp);
 	}
 }
 



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