Merge pull request #88 from 4e554c4c/alloc_crashing

Prevent alloc errors from crashing
This commit is contained in:
Drew DeVault 2017-08-15 12:21:58 -04:00 committed by GitHub
commit 27c13d621d
13 changed files with 109 additions and 13 deletions

View file

@ -277,8 +277,10 @@ static struct wlr_texture_impl wlr_texture_impl = {
};
struct wlr_texture *gles2_texture_init(struct wlr_egl *egl) {
struct wlr_gles2_texture *texture =
calloc(1, sizeof(struct wlr_gles2_texture));
struct wlr_gles2_texture *texture;
if (!(texture = calloc(1, sizeof(struct wlr_gles2_texture)))) {
return NULL;
}
wlr_texture_init(&texture->wlr_texture, &wlr_texture_impl);
texture->egl = egl;
return &texture->wlr_texture;