[clinfo] 44/148: Allocate with calloc, not malloc

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch clinfo
in repository clinfo.

commit 7050765e57cc08b4401dcbf615aeb53a5d5abb84
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Tue Apr 22 08:12:35 2014 +0200

    Allocate with calloc, not malloc
    
    Make sure the memory is initialized to 0, so that untouched array values
    have sensible values (for example, when no devices are present in a
    platform, `num_devs + p` could be untouched, and we want it to be zero
    in that case).
---
 src/memory.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/memory.h b/src/memory.h
index 042ebba..477c1a8 100644
--- a/src/memory.h
+++ b/src/memory.h
@@ -11,7 +11,7 @@
 } while (0)
 
 #define ALLOC(var, num, what) do { \
-	var = malloc((num)*sizeof(*var)); \
+	var = calloc(sizeof(*var), num); \
 	CHECK_MEM(var, what); \
 } while (0)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list