Fix Savannah bug #30135. * src/bdf/bdflib.c (_bdf_list_join): Don't modify value in static string `empty'. (_bdf_parse_glyph): Avoid memory leak in case of error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
diff --git a/ChangeLog b/ChangeLog
index 9ec8a37..8eda7e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-19 Werner Lemberg <wl@gnu.org>
+
+ Fix Savannah bug #30135.
+
+ * src/bdf/bdflib.c (_bdf_list_join): Don't modify value in static
+ string `empty'.
+ (_bdf_parse_glyph): Avoid memory leak in case of error.
+
2010-06-15 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #30108.
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index cc0f48f..6ce5c26 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+ * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
* Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -470,6 +470,11 @@
}
+ /* An empty string for empty fields. */
+
+ static const char empty[1] = { 0 }; /* XXX eliminate this */
+
+
static char *
_bdf_list_join( _bdf_list_t* list,
int c,
@@ -494,18 +499,14 @@
if ( i + 1 < list->used )
dp[j++] = (char)c;
}
- dp[j] = 0;
+ if ( dp != empty )
+ dp[j] = 0;
*alen = j;
return dp;
}
- /* An empty string for empty fields. */
-
- static const char empty[1] = { 0 }; /* XXX eliminate this */
-
-
static FT_Error
_bdf_list_split( _bdf_list_t* list,
char* separators,
@@ -1868,6 +1869,9 @@
error = BDF_Err_Invalid_File_Format;
Exit:
+ if ( error && ( p->flags & _BDF_GLYPH ) )
+ FT_FREE( p->glyph_name );
+
return error;
}