[gcompris-devel] [PATCH] Initialize the new GcomprisProperties with zeros

Peter Ujfalusi peter.ujfalusi at gmail.com
Wed Jan 26 04:49:29 UTC 2011


gc_prop_new uses malloc to allocate the GcomprisProperties.
Since malloc does not initialize the allocated memory, we
need to make sure, that it is initialized correctly.
Use memset to fill the allocated memory with zero.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at gmail.com>
---
Hello,

this patch fixes the problem that I have on 64bit machine:
No cursor visible after starting GCompris.
I have traced it down, and the tmp->nocursor was TRUE right
after the malloc call.

The patch is generated agains the git master.

PS: I'm not sure about the patch sending protocol for
GCompris, but I suppose git send-email shall be fine...

Br,
Peter

 src/gcompris/properties.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gcompris/properties.c b/src/gcompris/properties.c
index 29e43dd..0cd18cf 100644
--- a/src/gcompris/properties.c
+++ b/src/gcompris/properties.c
@@ -144,6 +144,7 @@ gc_prop_new ()
   GcomprisProperties *tmp;
 
   tmp = (GcomprisProperties *) malloc (sizeof (GcomprisProperties));
+  memset (tmp, 0, sizeof (GcomprisProperties));
   tmp->music		 = 1;
   tmp->fx		 = 1;
   tmp->fullscreen	 = 1;
-- 
1.7.4.rc2





More information about the Gcompris-devel mailing list