summary refs log tree commit diff stats
path: root/plugins/sysinfo
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/sysinfo')
-rw-r--r--plugins/sysinfo/match.c5
-rw-r--r--plugins/sysinfo/parse.c7
-rw-r--r--plugins/sysinfo/pci.c5
-rw-r--r--plugins/sysinfo/xsys.c2
4 files changed, 11 insertions, 8 deletions
diff --git a/plugins/sysinfo/match.c b/plugins/sysinfo/match.c
index ae850b5b..5f49ae41 100644
--- a/plugins/sysinfo/match.c
+++ b/plugins/sysinfo/match.c
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <unistd.h>
+#include <glib.h>
 #include "xsys.h"
 
 float percentage(unsigned long long *free, unsigned long long *total)
@@ -37,13 +38,13 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
 	double free_space, total_space;
 	free_space = *free_k;
 	total_space = *total_k;
-        result = malloc(bsize * sizeof(char));
+	result = g_new(char, bsize);
 	if (total_space == 0)
 	{
 		snprintf(result, bsize, "%s: none", desc);
 		return result;
 	}
-        quantity = quantities;
+	quantity = quantities;
 	while (total_space > 1023 && *(quantity + 1))
 	{
 		quantity++;
diff --git a/plugins/sysinfo/parse.c b/plugins/sysinfo/parse.c
index 6c86c645..caba8a7d 100644
--- a/plugins/sysinfo/parse.c
+++ b/plugins/sysinfo/parse.c
@@ -29,6 +29,7 @@
 #include <dirent.h>
 #include <sys/types.h>
 #include <pci/header.h>
+#include <glib.h>
 
 #include "pci.h"
 #include "match.h"
@@ -317,13 +318,13 @@ int xs_parse_df(const char *mount_point, char *result)
 			char *tmp_buf = pretty_freespace(pos, &free_k, &total_k);
 			strcat(tmp_buf, " | ");
 			strcat(result, tmp_buf);
-			free(tmp_buf);
+			g_free(tmp_buf);
 		}
 		else if(strncmp(mount_point, pos, strlen(mount_point)) == 0)
 		{
 			char *tmp_buf = pretty_freespace(mount_point, &free_k, &total_k);
 			strncpy(result, tmp_buf, bsize);
-			free(tmp_buf);
+			g_free(tmp_buf);
 			break;
 		}
 		else snprintf(result, bsize, "Mount point %s not found!", mount_point);
@@ -336,7 +337,7 @@ int xs_parse_df(const char *mount_point, char *result)
 	{
 		char *tmp_buf = pretty_freespace("Total", &free_k, &total_k);
 		strncpy(result, tmp_buf, bsize);
-		free(tmp_buf);
+		g_free(tmp_buf);
 	}
 	pclose(pipe);
 	return 0;
diff --git a/plugins/sysinfo/pci.c b/plugins/sysinfo/pci.c
index 9946c446..d0f8d811 100644
--- a/plugins/sysinfo/pci.c
+++ b/plugins/sysinfo/pci.c
@@ -25,6 +25,8 @@
 #include <ctype.h>
 #include <unistd.h>
 #include <pci/pci.h>
+#include <glib.h>
+
 #include "xsys.h"
 
 static struct pci_filter filter;       /* Device filter */
@@ -47,8 +49,7 @@ static struct device *scan_device(struct pci_dev *p)
 
   	if (!pci_filter_match(&filter, p))
     		return NULL;
-  	d = malloc(sizeof(struct device));
-  	bzero(d, sizeof(*d));
+  	d = g_new0 (struct device, 1);
   	d->dev = p;
   	if (!pci_read_block(p, 0, d->config, how_much))
     		exit(1);
diff --git a/plugins/sysinfo/xsys.c b/plugins/sysinfo/xsys.c
index ba02ad46..0c32b751 100644
--- a/plugins/sysinfo/xsys.c
+++ b/plugins/sysinfo/xsys.c
@@ -162,7 +162,7 @@ print_summary (int announce, char* format)
 
 	free_space = pretty_freespace ("Physical", &mem_free, &mem_total);
 	snprintf (buffer, bsize, "%s", free_space);
-	free (free_space);
+	g_free (free_space);
 	format_output ("RAM", buffer, format);	
 	strcat (sysinfo, "\017 ");
 	strncat (sysinfo, buffer, bsize - strlen (sysinfo));