Fix memory leaks in X11_CreateDevice error paths
Patch contributed by Andre Heider
This commit is contained in:
parent
a00f1423be
commit
aa816459ab
1 changed files with 6 additions and 0 deletions
|
@ -148,6 +148,8 @@ X11_CreateDevice(int devindex)
|
|||
device->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData));
|
||||
if (!device->gles_data) {
|
||||
SDL_OutOfMemory();
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -175,6 +177,10 @@ X11_CreateDevice(int devindex)
|
|||
}
|
||||
#endif
|
||||
if (data->display == NULL) {
|
||||
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||
SDL_free(device->gles_data);
|
||||
#endif
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
SDL_SetError("Couldn't open X11 display");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue