gterm: Prevent memory leak gterm_init() failure

This commit is contained in:
mintsuki 2022-10-06 03:24:54 +02:00
parent aca99ad790
commit 5bbda71da2
1 changed files with 4 additions and 4 deletions

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;