Handle NULL conditions of display and terminal allocation.
This commit is contained in:
parent
92c42ca959
commit
21b704690b
@ -150,6 +150,13 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
client_data->font_name, client_data->font_size,
|
||||
client->info.optimal_width, client->info.optimal_height);
|
||||
|
||||
/* Fail if terminal init failed */
|
||||
if (client_data->term == NULL) {
|
||||
guac_error = GUAC_STATUS_BAD_STATE;
|
||||
guac_error_message = "Terminal initialization failed";
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set up I-bar pointer */
|
||||
client_data->ibar_cursor = guac_ssh_create_ibar(client);
|
||||
|
||||
|
@ -119,6 +119,14 @@ guac_terminal* guac_terminal_create(guac_client* client,
|
||||
default_char.attributes.foreground,
|
||||
default_char.attributes.background);
|
||||
|
||||
/* Fail if display init failed */
|
||||
if (term->display == NULL) {
|
||||
guac_error = GUAC_STATUS_BAD_STATE;
|
||||
guac_error_message = "Display initialization failed";
|
||||
free(term);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Init terminal state */
|
||||
term->current_attributes = default_char.attributes;
|
||||
term->default_char = default_char;
|
||||
|
Loading…
Reference in New Issue
Block a user