Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/rasops Don't leak f on failure. Noted by maxv@.
details: https://anonhg.NetBSD.org/src/rev/2a4044fde228
branches: trunk
changeset: 331644:2a4044fde228
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 18 03:59:27 2014 +0000
description:
Don't leak f on failure. Noted by maxv@.
Compile-tested only, with zaurus.
diffstat:
sys/dev/rasops/rasops.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r 1cf10955e8e5 -r 2a4044fde228 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c Mon Aug 18 03:43:10 2014 +0000
+++ b/sys/dev/rasops/rasops.c Mon Aug 18 03:59:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.71 2012/04/19 06:57:39 macallan Exp $ */
+/* $NetBSD: rasops.c,v 1.72 2014/08/18 03:59:27 riastradh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.71 2012/04/19 06:57:39 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.72 2014/08/18 03:59:27 riastradh Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@@ -1351,16 +1351,21 @@
f = malloc(sizeof(struct rotatedfont), M_DEVBUF, M_WAITOK);
if (f == NULL)
- return;
+ goto fail0;
if ((ncookie = wsfont_rotate(*cookie, rotate)) == -1)
- return;
+ goto fail1;
f->rf_cookie = *cookie;
f->rf_rotated = ncookie;
SLIST_INSERT_HEAD(&rotatedfonts, f, rf_next);
*cookie = ncookie;
+ return;
+
+fail1: free(f, M_DEVBUF);
+fail0: /* Just use the existing font, I guess... */
+ return;
}
static void
Home |
Main Index |
Thread Index |
Old Index