From 92f9bd01d7c4c208c20cebf19f01d8fef8b95609 Mon Sep 17 00:00:00 2001 From: jca Date: Sun, 21 Jun 2015 20:49:18 +0000 Subject: [PATCH] Don't leak mem if wsfont_rotate() fails. Problem reported by Maxime Villard, ok miod@ --- sys/dev/rasops/rasops.c | 6 ++---- 1 file 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); -- 2.20.1