svn commit: r319508 - head/usr.bin/last

Stephen J. Kiernan stevek at FreeBSD.org
Fri Jun 2 20:25:26 UTC 2017


Author: stevek
Date: Fri Jun  2 20:25:25 2017
New Revision: 319508
URL: https://svnweb.freebsd.org/changeset/base/319508

Log:
  Fix a memory leak with last
  free memory allocated to 'buf'
  
  Submitted by:	Thomas Rix <trix at juniper.net>
  Reviewed by:	ed
  Approved by:	sjg (mentor)
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D9850

Modified:
  head/usr.bin/last/last.c

Modified: head/usr.bin/last/last.c
==============================================================================
--- head/usr.bin/last/last.c	Fri Jun  2 18:39:53 2017	(r319507)
+++ head/usr.bin/last/last.c	Fri Jun  2 20:25:25 2017	(r319508)
@@ -243,7 +243,7 @@ wtmp(void)
 	/* Display them in reverse order. */
 	while (amount > 0)
 		doentry(&buf[--amount]);
-
+	free(buf);
 	tm = localtime(&t);
 	(void) strftime(ct, sizeof(ct), "%+", tm);
 	printf("\n%s begins %s\n", ((file == NULL) ? "utx.log" : file), ct);


More information about the svn-src-all mailing list