From 51344ded145b42a0c766daf4a0787c92945c8d78 Mon Sep 17 00:00:00 2001 From: Bob Pendleton Date: Thu, 26 Jul 2007 17:58:17 +0000 Subject: [PATCH] changed to use SDL_realloc() --- src/video/x11/SDL_x11gamma.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/video/x11/SDL_x11gamma.c b/src/video/x11/SDL_x11gamma.c index 1d7f6d5d9..3a78f90f8 100644 --- a/src/video/x11/SDL_x11gamma.c +++ b/src/video/x11/SDL_x11gamma.c @@ -63,7 +63,6 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap, 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 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap, /* 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;