src/video/SDL_bmp.c
changeset 9336 1a1ec75b608c
parent 9334 5eb5ab33286e
child 9563 537881242756
     1.1 --- a/src/video/SDL_bmp.c	Sun Feb 08 15:44:15 2015 -0500
     1.2 +++ b/src/video/SDL_bmp.c	Sun Feb 08 22:50:16 2015 +0100
     1.3 @@ -307,16 +307,17 @@
     1.4          }
     1.5          if ((int) biClrUsed > palette->ncolors) {
     1.6              SDL_Color *colors;
     1.7 -            palette->ncolors = biClrUsed;
     1.8 +            int ncolors = biClrUsed;
     1.9              colors =
    1.10                  (SDL_Color *) SDL_realloc(palette->colors,
    1.11 -                                          palette->ncolors *
    1.12 +                                          ncolors *
    1.13                                            sizeof(*palette->colors));
    1.14              if (!colors) {
    1.15                  SDL_OutOfMemory();
    1.16                  was_error = SDL_TRUE;
    1.17                  goto done;
    1.18              }
    1.19 +            palette->ncolors = ncolors;
    1.20              palette->colors = colors;
    1.21          } else if ((int) biClrUsed < palette->ncolors) {
    1.22              palette->ncolors = biClrUsed;