[Xfce4-commits] <xfce4-cpugraph-plugin:master> Fix intermitent crash bug

Florian Rivoal noreply at xfce.org
Sat Jul 24 17:44:01 CEST 2010


Updating branch refs/heads/master
         to 72b960fbb3efe667fc448447e745c4594928eb31 (commit)
       from 1a426686c3b82a69f06419268227868def793fc1 (commit)

commit 72b960fbb3efe667fc448447e745c4594928eb31
Author: Florian Rivoal <frivoal at gmail.com>
Date:   Sun Jul 25 00:36:50 2010 +0900

    Fix intermitent crash bug
    
    Fix an off by one error in allocating an array, causing all sorts of
    intermitent problems as other memory got overwritten, including crashes.

 panel-plugin/cpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/panel-plugin/cpu.c b/panel-plugin/cpu.c
index 0a85e49..ca9628f 100644
--- a/panel-plugin/cpu.c
+++ b/panel-plugin/cpu.c
@@ -114,7 +114,7 @@ guint init_cpu_data( CpuData **data )
 	if( cpuNr == 0 )
 		return 0;
 
-	*data = (CpuData *) g_malloc0( cpuNr * sizeof( CpuData ) );
+	*data = (CpuData *) g_malloc0( (cpuNr+1) * sizeof( CpuData ) );
 
 	return cpuNr;
 }



More information about the Xfce4-commits mailing list