- Allocate enough space to hold an object.
- No need to request to zero clear when we overwrite soon.
This commit is contained in:
parent
addff245d7
commit
4aaba8dea1
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wsfont.c,v 1.27 2002/03/20 12:18:56 ad Exp $ */
|
||||
/* $NetBSD: wsfont.c,v 1.28 2002/03/21 03:26:55 enami Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.27 2002/03/20 12:18:56 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.28 2002/03/21 03:26:55 enami Exp $");
|
||||
|
||||
#include "opt_wsfont.h"
|
||||
|
||||
@ -340,7 +340,7 @@ wsfont_add0(struct wsdisplay_font *font, int copy)
|
||||
struct font *ent;
|
||||
size_t size;
|
||||
|
||||
ent = malloc(sizeof(struct font *), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
ent = malloc(sizeof(struct font), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
/* Is this font statically allocated? */
|
||||
if (!copy) {
|
||||
@ -348,7 +348,7 @@ wsfont_add0(struct wsdisplay_font *font, int copy)
|
||||
ent->flags = WSFONT_STATIC;
|
||||
} else {
|
||||
ent->font = malloc(sizeof(struct wsdisplay_font), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
M_WAITOK);
|
||||
memcpy(ent->font, font, sizeof(*ent->font));
|
||||
|
||||
size = font->fontheight * font->numchars * font->stride;
|
||||
|
Loading…
x
Reference in New Issue
Block a user