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 <[email protected]>
  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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to