Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons try not to crash when calling glyphcache_wipe...
details: https://anonhg.NetBSD.org/src/rev/72c10291abe8
branches: trunk
changeset: 792695:72c10291abe8
user: macallan <macallan%NetBSD.org@localhost>
date: Mon Jan 13 19:30:33 2014 +0000
description:
try not to crash when calling glyphcache_wipe() on an uninitialized cache
first step to fix PR 48492
diffstat:
sys/dev/wscons/wsdisplay_glyphcache.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (28 lines):
diff -r 20f834ecbe31 -r 72c10291abe8 sys/dev/wscons/wsdisplay_glyphcache.c
--- a/sys/dev/wscons/wsdisplay_glyphcache.c Mon Jan 13 18:57:48 2014 +0000
+++ b/sys/dev/wscons/wsdisplay_glyphcache.c Mon Jan 13 19:30:33 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_glyphcache.c,v 1.5 2012/11/13 20:29:03 macallan Exp $ */
+/* $NetBSD: wsdisplay_glyphcache.c,v 1.6 2014/01/13 19:30:33 macallan Exp $ */
/*
* Copyright (c) 2012 Michael Lorenz
@@ -67,6 +67,8 @@
gc->gc_cellheight = cellheight;
gc->gc_firstline = first;
gc->gc_cellsperline = width / cellwidth;
+ gc->gc_buckets = NULL;
+ gc->gc_numbuckets = 0;
if (lines < 0) lines = 0;
cache_lines = lines / cellheight;
gc->gc_numcells = cache_lines * gc->gc_cellsperline;
@@ -124,6 +126,9 @@
gc_bucket *b;
int i, j, idx;
+ if ((gc->gc_buckets == NULL) || (gc->gc_numbuckets < 1))
+ return;
+
idx = gc->gc_buckets[0].gb_index;
/* empty all the buckets */
Home |
Main Index |
Thread Index |
Old Index