mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-21 06:59:46 -05:00
Added wl_connection_create failure checks.
This commit is contained in:
parent
fcd4caa0df
commit
ecbad0341e
3 changed files with 12 additions and 1 deletions
|
|
@ -160,6 +160,8 @@ wl_connection_create(int fd,
|
|||
struct wl_connection *connection;
|
||||
|
||||
connection = malloc(sizeof *connection);
|
||||
if (connection == NULL)
|
||||
return NULL;
|
||||
memset(connection, 0, sizeof *connection);
|
||||
connection->fd = fd;
|
||||
connection->update = update;
|
||||
|
|
|
|||
|
|
@ -394,7 +394,12 @@ wl_display_connect(const char *name)
|
|||
display->connection = wl_connection_create(display->fd,
|
||||
connection_update,
|
||||
display);
|
||||
|
||||
if (display->connection == NULL) {
|
||||
wl_hash_table_destroy(display->objects);
|
||||
close(display->fd);
|
||||
free(display);
|
||||
return NULL;
|
||||
}
|
||||
return display;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,10 @@ wl_client_create(struct wl_display *display, int fd)
|
|||
wl_client_connection_data, client);
|
||||
client->connection =
|
||||
wl_connection_create(fd, wl_client_connection_update, client);
|
||||
if (client->connection == NULL) {
|
||||
free(client);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wl_list_init(&client->resource_list);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue