| Summary: | SDL_calloc might returns NULL in SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) function | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Nitz <nitin.j4> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | 2.0.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
The sizeof() is fine, but you're right that it needs to check the return value of SDL_calloc(). This is now fixed, thanks! http://hg.libsdl.org/SDL/rev/f35ff854121a |
In function: SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { // Some Code window = (SDL_Window *)SDL_calloc(1, sizeof(*window));// In this SDL_calloc sometimes might return NULL. // Some Code } In above function SDL_calloc sometimes might return NULL to window, which is not accepted. So to avoid this, patch should be: window = (SDL_Window *)SDL_calloc(1, sizeof(SDL_Window)); Thanks, Nitz