src/video/x11/SDL_x11gamma.c
changeset 2216 82a133b784c9
parent 2214 e7164a4dac62
child 2221 1d75c38e1e5c
--- a/src/video/x11/SDL_x11gamma.c	Wed Jul 25 21:23:28 2007 +0000
+++ b/src/video/x11/SDL_x11gamma.c	Thu Jul 26 17:58:17 2007 +0000
@@ -63,7 +63,6 @@
                   XStandardColormap * cmap, Visual * visual)
 {
     int i;
-    cmapTableEntry *newTable = NULL;
 
     /* search the table to find out if we already have this one. We
        only want one entry for each display, screen number, visualid,
@@ -79,18 +78,12 @@
 
     /* increase the table by one entry. If the table is NULL create the
        first entrty */
-    newTable = SDL_malloc((numCmaps + 1) * sizeof(cmapTableEntry));
-    if (NULL == newTable) {
+    cmapTable = SDL_realloc(cmapTable, (numCmaps + 1) * sizeof(cmapTableEntry));
+    if (NULL == cmapTable) {
         SDL_SetError("Out of memory in X11_TrackColormap()");
         return;
     }
 
-    if (NULL != cmapTable) {
-        SDL_memcpy(newTable, cmapTable, numCmaps * sizeof(cmapTableEntry));
-        SDL_free(cmapTable);
-    }
-    cmapTable = newTable;
-
     cmapTable[numCmaps].display = display;
     cmapTable[numCmaps].scrNum = scrNum;
     cmapTable[numCmaps].colormap = colormap;