From: Søren Sandmann Pedersen <s...@redhat.com> --- pixman/pixman-filter.c | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c index c9d2dc7..6fe7c93 100644 --- a/pixman/pixman-filter.c +++ b/pixman/pixman-filter.c @@ -231,6 +231,8 @@ create_1d_filter (int *width, *width = ceil (size); p = params = malloc (*width * n_phases * sizeof (pixman_fixed_t)); + if (!params) + return NULL; step = 1.0 / n_phases; @@ -309,7 +311,7 @@ pixman_filter_create_separable_convolution (int *n_values, { double sx = fabs (pixman_fixed_to_double (scale_x)); double sy = fabs (pixman_fixed_to_double (scale_y)); - pixman_fixed_t *horz, *vert, *params; + pixman_fixed_t *horz = NULL, *vert = NULL, *params = NULL; int subsample_x, subsample_y; int width, height; @@ -323,15 +325,18 @@ pixman_filter_create_separable_convolution (int *n_values, params = malloc (*n_values * sizeof (pixman_fixed_t)); - params[0] = pixman_int_to_fixed (width); - params[1] = pixman_int_to_fixed (height); - params[2] = pixman_int_to_fixed (subsample_bits_x); - params[3] = pixman_int_to_fixed (subsample_bits_y); - - memcpy (params + 4, horz, - width * subsample_x * sizeof (pixman_fixed_t)); - memcpy (params + 4 + width * subsample_x, vert, - height * subsample_y * sizeof (pixman_fixed_t)); + if (horz && vert && params) + { + params[0] = pixman_int_to_fixed (width); + params[1] = pixman_int_to_fixed (height); + params[2] = pixman_int_to_fixed (subsample_bits_x); + params[3] = pixman_int_to_fixed (subsample_bits_y); + + memcpy (params + 4, horz, + width * subsample_x * sizeof (pixman_fixed_t)); + memcpy (params + 4 + width * subsample_x, vert, + height * subsample_y * sizeof (pixman_fixed_t)); + } free (horz); free (vert); -- 1.7.4 _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pixman