diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-12-25 23:58:15 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-12-25 23:58:15 +0000 |
commit | f475c68410cf4312188203cadd294a042ab23c6d (patch) | |
tree | dd933ac64f17c64d38d991287ac390d3bff410d9 | |
parent | f817c58ea799274eb832d25dc61acb5955f9b2d9 (diff) |
Do not allow loading a font in an used font slot; discussed with and ok mickey@
-rw-r--r-- | sys/dev/ic/vga.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 4b27642c684..35d8bb8083c 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga.c,v 1.34 2004/11/04 15:03:53 mickey Exp $ */ +/* $OpenBSD: vga.c,v 1.35 2004/12/25 23:58:14 miod Exp $ */ /* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */ /* @@ -868,9 +868,10 @@ vga_load_font(v, cookie, data) if (slot >= 8) return (ENOSPC); - if (!vc->vc_fonts[slot]) - f = malloc(sizeof(struct vgafont), M_DEVBUF, M_WAITOK); - if (!f) + if (vc->vc_fonts[slot] != NULL) + return (EEXIST); + f = malloc(sizeof(struct vgafont), M_DEVBUF, M_WAITOK); + if (f == NULL) return (ENOMEM); strlcpy(f->name, data->name, sizeof(f->name)); f->height = data->fontheight; |