Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jun 2017 20:25:25 +0000 (UTC)
From:      "Stephen J. Kiernan" <stevek@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319508 - head/usr.bin/last
Message-ID:  <201706022025.v52KPPuT020224@repo.freebsd.org>

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



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