Navigation Menu

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

Commit

Permalink
Fixed NULL pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 13, 2009
1 parent f48775b commit c39a689
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CREDITS
Expand Up @@ -25,8 +25,9 @@ Thanks to everyone who made this possible, including:
* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
during the Google Summer of Code 2008

* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, and Couriersud
for helping find SDL 1.3 bugs in the great SDL Bug Hunt of January 2009!
* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
and Couriersud for helping find SDL 1.3 bugs in the great SDL Bug Hunt
of January 2009!

* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
January 2009!
Expand Down
3 changes: 1 addition & 2 deletions include/SDL_compat.h
Expand Up @@ -228,8 +228,7 @@ extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
int height,
int bpp, Uint32 flags);
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
Uint32 flags);
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
int height,
int bpp, Uint32 flags);
Expand Down
6 changes: 5 additions & 1 deletion src/SDL_compat.c
Expand Up @@ -114,7 +114,7 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
}

SDL_Rect **
SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
{
int i, nmodes;
SDL_Rect **modes;
Expand All @@ -127,6 +127,10 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
return (SDL_Rect **) (-1);
}

if (!format) {
format = SDL_GetVideoInfo()->vfmt;
}

/* Memory leak, but this is a compatibility function, who cares? */
nmodes = 0;
modes = NULL;
Expand Down

0 comments on commit c39a689

Please sign in to comment.