- Fix a memory leak due a improper memset

This commit is contained in:
Danilo Egea Gondolfo 2014-09-10 16:32:24 +00:00
parent 6474550ee8
commit 7cd1c8fc5a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=367872
2 changed files with 9 additions and 10 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= xfce4-diskperf-plugin
PORTVERSION= 2.5.4
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils xfce
MASTER_SITES= ${MASTER_SITE_XFCE}
MASTER_SITE_SUBDIR= src/panel-plugins/${PORTNAME}/${PORTVERSION:R}

View File

@ -1,6 +1,6 @@
--- ./panel-plugin/devperf.c.orig 2012-04-03 10:22:41.000000000 -0300
+++ ./panel-plugin/devperf.c 2013-09-11 17:45:00.000000000 -0300
@@ -225,6 +225,94 @@
--- panel-plugin/devperf.c.orig 2012-04-03 13:22:41 UTC
+++ panel-plugin/devperf.c
@@ -225,6 +225,93 @@
/************************** Linux End ***************/
@ -22,8 +22,13 @@
+
+#define MAXNAMELEN 256
+
+struct statinfo stats;
+struct devinfo dinfo;
+
+int DevPerfInit ()
+{
+ stats.dinfo = &dinfo;
+
+ return (0);
+}
+
@ -36,17 +41,11 @@
+{
+ struct timeval tv;
+ struct timespec ts;
+ struct statinfo stats;
+ struct devinfo dinfo;
+ struct devstat dev;
+ kvm_t *kd = NULL;
+ int i, found = 0;
+ char *check_dev = (char *) p_pvDevice;
+
+ memset(&stats, 0, sizeof(stats));
+ memset(&dinfo, 0, sizeof(dinfo));
+ stats.dinfo = &dinfo;
+
+ if(devstat_getdevs(kd, &stats) == -1) {
+ syslog(0, "DISKPERF: getdevs fail");
+ }