If the malloc fails, memset would touch invalid memory.
---
src/wayland-server.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 75de313..3c162d4 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1150,10 +1150,11 @@ wl_display_add_socket_auto(struct wl_display *display)
const int MAX_DISPLAYNO = 32;
s = malloc(sizeof *s);
- memset(s, 0, sizeof *s);
if (s == NULL)
return NULL;
+ memset(s, 0, sizeof *s);
+
do {
snprintf(display_name, sizeof display_name, "wayland-%d",
displayno);
if (wl_socket_init_for_display_name(s, display_name) < 0) {
--
2.0.4
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel