summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2015-06-21 20:49:19 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2015-06-21 20:49:19 +0000
commit9b7bdd8d3c45a78fac0d3a26a981504b551cd15c (patch)
treef9d5daab4d015ce0e486427c42072142d1acaaf3
parent70942e7545641f9959864abc98910cbdd8209eb1 (diff)
Don't leak mem if wsfont_rotate() fails.
Problem reported by Maxime Villard, ok miod@
-rw-r--r--sys/dev/rasops/rasops.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c
index 917c35906db..f4e2b207993 100644
--- a/sys/dev/rasops/rasops.c
+++ b/sys/dev/rasops/rasops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rasops.c,v 1.39 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: rasops.c,v 1.40 2015/06/21 20:49:18 jca Exp $ */
/* $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $ */
/*-
@@ -1163,12 +1163,10 @@ rasops_rotate_font(int *cookie)
* We did not find a rotated version of this font. Ask the wsfont
* code to compute one for us.
*/
-
- f = malloc(sizeof(struct rotatedfont), M_DEVBUF, M_WAITOK);
-
if ((ncookie = wsfont_rotate(*cookie)) == -1)
return;
+ f = malloc(sizeof(struct rotatedfont), M_DEVBUF, M_WAITOK);
f->rf_cookie = *cookie;
f->rf_rotated = ncookie;
SLIST_INSERT_HEAD(&rotatedfonts, f, rf_next);