[Xfce4-commits] [panel-plugins/xfce4-diskperf-plugin] 01/01: Fix a memory leak in the FreeBSD codepath (#11153)

noreply at xfce.org noreply at xfce.org
Thu Sep 11 15:46:59 CEST 2014


This is an automated email from the git hooks/post-receive script.

landry pushed a commit to branch master
in repository panel-plugins/xfce4-diskperf-plugin.

commit 5c8143716c625ad26e20651d09c0fc40ccacb1bb
Author: Danilo Egea <daniloegea at yahoo.com.br>
Date:   Thu Sep 11 15:46:32 2014 +0200

    Fix a memory leak in the FreeBSD codepath (#11153)
---
 panel-plugin/devperf.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/devperf.c b/panel-plugin/devperf.c
index 45391d5..26e5ee8 100644
--- a/panel-plugin/devperf.c
+++ b/panel-plugin/devperf.c
@@ -257,17 +257,13 @@ int DevGetPerfData (const void *p_pvDevice, struct devperf_t *perf)
 {
 	struct timeval tv;
 	struct timespec ts;
-	struct statinfo stats;
-	struct devinfo dinfo;
+	static struct devinfo dinfo;
+	static struct statinfo stats = {.dinfo = &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");
 	}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list