diff options
Diffstat (limited to 'xorg-server/glamor/glamor_gradient.c')
-rw-r--r-- | xorg-server/glamor/glamor_gradient.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xorg-server/glamor/glamor_gradient.c b/xorg-server/glamor/glamor_gradient.c index 8ea645efc..d34131d35 100644 --- a/xorg-server/glamor/glamor_gradient.c +++ b/xorg-server/glamor/glamor_gradient.c @@ -997,13 +997,13 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, /* Set all the stops and colors to shader. */ if (stops_count > RADIAL_SMALL_STOPS) { - stop_colors = malloc(4 * stops_count * sizeof(float)); + stop_colors = xallocarray(stops_count, 4 * sizeof(float)); if (stop_colors == NULL) { ErrorF("Failed to allocate stop_colors memory.\n"); goto GRADIENT_FAIL; } - n_stops = malloc(stops_count * sizeof(float)); + n_stops = xallocarray(stops_count, sizeof(float)); if (n_stops == NULL) { ErrorF("Failed to allocate n_stops memory.\n"); goto GRADIENT_FAIL; @@ -1338,13 +1338,13 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, /* Set all the stops and colors to shader. */ if (stops_count > LINEAR_SMALL_STOPS) { - stop_colors = malloc(4 * stops_count * sizeof(float)); + stop_colors = xallocarray(stops_count, 4 * sizeof(float)); if (stop_colors == NULL) { ErrorF("Failed to allocate stop_colors memory.\n"); goto GRADIENT_FAIL; } - n_stops = malloc(stops_count * sizeof(float)); + n_stops = xallocarray(stops_count, sizeof(float)); if (n_stops == NULL) { ErrorF("Failed to allocate n_stops memory.\n"); goto GRADIENT_FAIL; |