libweston: use xstrdup for head strings
We never expected these strdups to fail, and things tend to assume these fields are not NULL (except serial_number). Use xstrdup to ensure that a catastrophic OOM is immediately obvious. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
3728d7e99b
commit
c26335bfdb
@ -5929,7 +5929,7 @@ weston_head_init(struct weston_head *head, const char *name)
|
||||
wl_list_init(&head->output_link);
|
||||
wl_list_init(&head->resource_list);
|
||||
wl_list_init(&head->xdg_output_resource_list);
|
||||
head->name = strdup(name);
|
||||
head->name = xstrdup(name);
|
||||
head->supported_eotf_mask = WESTON_EOTF_MODE_SDR;
|
||||
head->current_protection = WESTON_HDCP_DISABLE;
|
||||
}
|
||||
@ -6351,9 +6351,9 @@ weston_head_set_monitor_strings(struct weston_head *head,
|
||||
free(head->model);
|
||||
free(head->serial_number);
|
||||
|
||||
head->make = make ? strdup(make) : NULL;
|
||||
head->model = model ? strdup(model) : NULL;
|
||||
head->serial_number = serialno ? strdup(serialno) : NULL;
|
||||
head->make = make ? xstrdup(make) : NULL;
|
||||
head->model = model ? xstrdup(model) : NULL;
|
||||
head->serial_number = serialno ? xstrdup(serialno) : NULL;
|
||||
|
||||
weston_head_set_device_changed(head);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user