Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
changed to use SDL_realloc()
  • Loading branch information
pendletonrc committed Jul 26, 2007
1 parent 3179b61 commit 51344de
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/video/x11/SDL_x11gamma.c
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 51344de

Please sign in to comment.