aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/gamma-helper.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-04 00:46:50 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-04 00:46:50 +0200
commitd4e97598c2dd23ffa8d2e14ee6840fe53d925d22 (patch)
treeeee8fead54c7a0746137ad1fa5a69e9d8ebe5f9d /src/lib/gamma-helper.c
parentfix float to integer overflow (diff)
downloadlibgamma-d4e97598c2dd23ffa8d2e14ee6840fe53d925d22.tar.gz
libgamma-d4e97598c2dd23ffa8d2e14ee6840fe53d925d22.tar.bz2
libgamma-d4e97598c2dd23ffa8d2e14ee6840fe53d925d22.tar.xz
fix which ramps are getting calloc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/lib/gamma-helper.c')
-rw-r--r--src/lib/gamma-helper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/gamma-helper.c b/src/lib/gamma-helper.c
index 44e0ff5..470374a 100644
--- a/src/lib/gamma-helper.c
+++ b/src/lib/gamma-helper.c
@@ -263,7 +263,12 @@ static int allocated_any_ramp(libgamma_gamma_ramps_any_t* restrict ramps_sys,
/* Copy the gamma ramp sizes. */
ramps_sys->ANY = ramps.ANY;
/* Allocate the new ramps. */
- ramps_sys->ANY.red = malloc(n * d);
+#ifdef HAVE_LIBGAMMA_METHOD_LINUX_DRM
+ /* Valgrind complains about us reading uninitialize memory if we just use malloc. */
+ ramps_sys->ANY.red = calloc(n, d);
+#else
+ ramps_sys->ANY.red = malloc(n * d);
+#endif
ramps_sys->ANY.green = (void*)(((char*)(ramps_sys->ANY. red)) + ramps.ANY. red_size * d / sizeof(char));
ramps_sys->ANY.blue = (void*)(((char*)(ramps_sys->ANY.green)) + ramps.ANY.green_size * d / sizeof(char));