commit 9f89adb
Michael Forney
·
2014-11-02 01:22:33 +0000 UTC
parent 745ce8b
wayland-shm: Handle potential malloc failure
1 files changed,
+4,
-1
+4,
-1
1@@ -285,7 +285,10 @@ void registry_global_remove(void * data, struct wl_registry * registry,
2 void shm_format(void * data, struct wl_shm * wl, uint32_t format)
3 {
4 struct shm_context * context = data;
5+ uint32_t * added_format;
6
7- *((uint32_t *) wl_array_add(&context->formats, sizeof format)) = format;
8+ if (!(added_format = wl_array_add(&context->formats, sizeof format)))
9+ return;
10+ *added_format = format;
11 }
12