Rémi Bernon (@rbernon) commented about dlls/winewayland.drv/wayland_text_input.c:
static void text_input_commit_string(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, const char *text) {
- struct wayland_text_input *text_input = data;
- TRACE("data %p, text_input %p, text %s.\n", data, zwp_text_input_v3, debugstr_a(text));
- pthread_mutex_lock(&text_input->mutex);
- text_input->commit_string = malloc(strlen(text) + 1);
- if (!text_input->commit_string)
- {
ERR("Failed to allocate memory for IME commit string.\n");
pthread_mutex_unlock(&text_input->mutex);
return;
- }
- strcpy(text_input->commit_string, text);
```suggestion:-7+0 text_input->commit_string = strdup(text); ```
I don't think we need to print an error on every memory allocation failures, they are very unlikely and going to happen everywhere anyway. Let's make the code simpler instead.