>From 0a0f6c2e17b381336b9ab875c6f95ea46c8f7c44 Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <hol...@moiji-mobile.com>
Date: Wed, 26 Oct 2011 16:19:57 +0200
Subject: [PATCH 1/2] [valgrind] Use D_MAGIC_SET_ONLY when initializing the
 lock

In load_default_cursor a CoreSurfaceBufferLock is placed on the stack
without any initialization, the address is passed to dfb_surface_lock_buffer
which will call dfb_surface_buffer_lock_init to initialize the lock, in
there D_MAGIC_SET is used that will compare the random magic with the one
to be set. Valgrind complains about this unitialized read.

Use D_MAGIC_SET_ONLY to set the magic wihtout looking at the current
value, the alternative would be to initialize the CoreSurfaceBufferLock
on the stack with the magic set (or provide a macro for that).
---
 src/core/surface_buffer.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/core/surface_buffer.h b/src/core/surface_buffer.h
index 0ca5bff..bb02d4b 100644
--- a/src/core/surface_buffer.h
+++ b/src/core/surface_buffer.h
@@ -145,7 +145,7 @@ dfb_surface_buffer_lock_reset( CoreSurfaceBufferLock *lock )
 static inline void
 dfb_surface_buffer_lock_init( CoreSurfaceBufferLock *lock, 
CoreSurfaceAccessorID accessor, CoreSurfaceAccessFlags access )
 {
-     D_MAGIC_SET( lock, CoreSurfaceBufferLock );
+     D_MAGIC_SET_ONLY( lock, CoreSurfaceBufferLock );
 
      lock->accessor = accessor;
      lock->access   = access;
-- 
1.7.7.1


_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to