gterm: Prevent memory leak gterm_init() failure

This commit is contained in:
mintsuki 2022-10-06 03:24:54 +02:00
parent fb994e61c6
commit 6e1c792e41

View File

@ -776,15 +776,15 @@ no_load_font:;
font_scale_x, font_scale_y,
margin);
if (term == NULL) {
return false;
}
pmm_free(font, FONT_MAX);
if (bg_canvas != NULL) {
pmm_free(bg_canvas, bg_canvas_size);
}
if (term == NULL) {
return false;
}
if (serial) {
term->cols = term->cols > 80 ? 80 : term->cols;
term->rows = term->rows > 24 ? 24 : term->rows;