From 03593f53e75295ca93bc5cc911094e75c9f38637 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 6 Apr 2006 23:50:44 +0000 Subject: Coverity #1083: Fix a use after free case. --- src/glu/sgi/libtess/dict.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/glu/sgi') diff --git a/src/glu/sgi/libtess/dict.c b/src/glu/sgi/libtess/dict.c index fac8032ff3..c20f694850 100644 --- a/src/glu/sgi/libtess/dict.c +++ b/src/glu/sgi/libtess/dict.c @@ -35,8 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/dict.c,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Date: 2006/04/06 23:50:44 $ $Revision: 1.2 $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/dict.c,v 1.2 2006/04/06 23:50:44 ajax Exp $ */ #include @@ -68,9 +68,13 @@ Dict *dictNewDict( void *frame, void dictDeleteDict( Dict *dict ) { DictNode *node; + int done = 0; - for( node = dict->head.next; node != &dict->head; node = node->next ) { + for( node = dict->head.next; ; node = node->next ) { + done = (node == &dict->head); memFree( node ); + if (done) + break; } memFree( dict ); } -- cgit v1.2.3