input_manager: fix potential memory leak on text

Fix potential memory leak when controller_push_event failed.

Signed-off-by: yuchenlin <npes87184@gmail.com>
This commit is contained in:
yuchenlin 2018-10-27 20:07:22 +08:00
parent 0b92b93358
commit 96056e3213

View file

@ -144,6 +144,7 @@ void input_manager_process_text_input(struct input_manager *input_manager,
return;
}
if (!controller_push_event(input_manager->controller, &control_event)) {
SDL_free(control_event.text_event.text);
LOGW("Cannot send text event");
}
}