examples: assert on memory allocation

Also checks for NULL output in the `X_from_device` functions
This commit is contained in:
Simon Zeni 2024-04-08 10:11:50 -04:00
parent ebef710746
commit 7cb206deb4
11 changed files with 39 additions and 1 deletions

View file

@ -1,3 +1,4 @@
#include <assert.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
@ -145,6 +146,7 @@ static void handle_new_surface(struct wl_listener *listener, void *data) {
struct wlr_surface *wlr_surface = data;
struct surface *surface = calloc(1, sizeof(*surface));
assert(surface);
surface->wlr = wlr_surface;
surface->commit.notify = surface_handle_commit;