1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

Fix an issue with accessing a bad memory address in my previous patch.

I had the correct code locally, but I committed the bad version.  Without
this, libgtop would crash.

Approved by:	portmgr (implicit)
This commit is contained in:
Joe Marcus Clarke 2009-04-13 17:52:54 +00:00
parent fc90fbd34e
commit 8784ec5c6f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=232318
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@
PORTNAME= libgtop
PORTVERSION= 2.26.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome2

View File

@ -4,7 +4,7 @@
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
{
long cpts [CPUSTATES];
+ long *cp_times;
+ long *cp_times = NULL;
struct clockinfo ci;
size_t length;
int ncpu, i;
@ -16,7 +16,7 @@
+ if (sysctlbyname ("kern.cp_times", NULL, &length, NULL, 0) == 0) {
+ cp_times = g_malloc (length);
+ length = sizeof(long) * CPUSTATES * (length / (sizeof(long) * CPUSTATES));
+ if (sysctlbyname ("kern.cp_times", &cp_times, &length, NULL, 0)) {
+ if (sysctlbyname ("kern.cp_times", cp_times, &length, NULL, 0)) {
+ g_free (cp_times);
+ cp_times = NULL;
+ }