aboutsummaryrefslogtreecommitdiffstats
path: root/src/libgamma-method.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-22 21:12:44 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-22 21:12:44 +0200
commitab7f957f377cc1d28d35785fefb185533da9f6e4 (patch)
treeca7370b75b0d033b0105987fc4d1ebf23ea7b72d /src/libgamma-method.c
parentm misc + gamma-quartz-cg (diff)
downloadlibgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.gz
libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.bz2
libgamma-ab7f957f377cc1d28d35785fefb185533da9f6e4.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libgamma-method.c')
-rw-r--r--src/libgamma-method.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libgamma-method.c b/src/libgamma-method.c
index 164d0b4..47afd54 100644
--- a/src/libgamma-method.c
+++ b/src/libgamma-method.c
@@ -233,10 +233,15 @@ void libgamma_gamma_rampsf_free(libgamma_gamma_rampsf_t* restrict this)
int libgamma_gamma_rampsd_initialise(libgamma_gamma_rampsd_t* restrict this)
{
size_t n = this->red_size + this->green_size + this->blue_size;
- this->red = malloc(n * sizeof(double));
+#ifdef HAVE_GAMMA_METHOD_LINUX_DRM
+ /* Valgrind complains about us reading uninitialize memory if we just use malloc. */
+ this->red = calloc(n, sizeof(double));
+#else
+ this->red = malloc(n * sizeof(double));
+#endif
this->green = this-> red + this-> red_size;
this->blue = this->green + this->green_size;
- return this->red ? 0 : -1;
+ return this->red == NULL ? -1 : 0;
}