# HG changeset patch # User Bob Pendleton # Date 1185472697 0 # Node ID 82a133b784c981ccfd5f2d189a757bd6b4109b20 # Parent 23a2cb7650526a985910fe30feb5445a04e97026 changed to use SDL_realloc() diff -r 23a2cb765052 -r 82a133b784c9 src/video/x11/SDL_x11gamma.c --- 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;