From 2c2f63d0f17106964c808f8f0ec5bb58f35b4fe5 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 3 Jun 2006 06:33:40 +0000 Subject: Coverity #1523: Dereferencing freed pointer "mapping" --- src/encparse.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/encparse.c b/src/encparse.c index 62a889d..9375ed9 100644 --- a/src/encparse.c +++ b/src/encparse.c @@ -1,4 +1,4 @@ -/* $XdotOrg: $ */ +/* $XdotOrg: lib/fontenc/src/encparse.c,v 1.6 2006/04/10 16:15:12 alanc Exp $ */ /* Copyright (c) 1998-2001 by Juliusz Chroboczek @@ -773,12 +773,14 @@ error: xfree(mapping); } if(encoding) { - if(encoding->name) xfree(encoding->name); - for(mapping = encoding->mappings; mapping; mapping = mapping->next) { - if(mapping->client_data) xfree(mapping->client_data); - xfree(mapping); - } - xfree(encoding); + FontMapPtr nextmap; + if (encoding->name) xfree(encoding->name); + for (mapping = encoding->mappings; mapping; mapping = nextmap) { + if (mapping->client_data) xfree(mapping->client_data); + nextmap = mapping->next; + xfree(mapping); + } + xfree(encoding); } for(i = 0; i < numaliases; i++) xfree(aliases[i]); -- cgit v1.2.3