Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2020 16:07:41 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364996 - head/lib/libpmc/pmu-events
Message-ID:  <202008311607.07VG7fFA035195@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Mon Aug 31 16:07:40 2020
New Revision: 364996
URL: https://svnweb.freebsd.org/changeset/base/364996

Log:
  libpmc: Fix memory leak in process_mapfile
  
  Coverity detected memory leak fix.
  
  Submitted by:	bret_ketchum@dell.com
  Reported by:	Coverity
  Reviewed by:	cem
  MFC after:	2 weeks
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D26230

Modified:
  head/lib/libpmc/pmu-events/jevents.c

Modified: head/lib/libpmc/pmu-events/jevents.c
==============================================================================
--- head/lib/libpmc/pmu-events/jevents.c	Mon Aug 31 15:59:17 2020	(r364995)
+++ head/lib/libpmc/pmu-events/jevents.c	Mon Aug 31 16:07:40 2020	(r364996)
@@ -794,6 +794,7 @@ process_mapfile(FILE *outfp, char *fpath)
 	if (!mapfp) {
 		pr_info("%s: Error %s opening %s\n", prog, strerror(errno),
 				fpath);
+		free(line);
 		return -1;
 	}
 
@@ -850,6 +851,8 @@ process_mapfile(FILE *outfp, char *fpath)
 
 out:
 	print_mapping_table_suffix(outfp);
+	free(line);
+	fclose(mapfp);
 	return 0;
 }
 



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