aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/base/ftinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/base/ftinit.c')
-rw-r--r--freetype/src/base/ftinit.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/freetype/src/base/ftinit.c b/freetype/src/base/ftinit.c
index 224b7ce37..b23f2394d 100644
--- a/freetype/src/base/ftinit.c
+++ b/freetype/src/base/ftinit.c
@@ -4,7 +4,7 @@
/* */
/* FreeType initialization layer (body). */
/* */
-/* Copyright 1996-2002, 2005, 2007, 2009, 2012, 2013 by */
+/* Copyright 1996-2002, 2005, 2007, 2009, 2012-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -235,6 +235,8 @@
FT_Memory memory;
+ /* check of `alibrary' delayed to `FT_New_Library' */
+
/* First of all, allocate a new system object -- this function is part */
/* of the system-specific component, i.e. `ftsystem.c'. */
@@ -263,17 +265,19 @@
FT_EXPORT_DEF( FT_Error )
FT_Done_FreeType( FT_Library library )
{
- if ( library )
- {
- FT_Memory memory = library->memory;
+ FT_Memory memory;
- /* Discard the library object */
- FT_Done_Library( library );
+ if ( !library )
+ return FT_THROW( Invalid_Library_Handle );
- /* discard memory manager */
- FT_Done_Memory( memory );
- }
+ memory = library->memory;
+
+ /* Discard the library object */
+ FT_Done_Library( library );
+
+ /* discard memory manager */
+ FT_Done_Memory( memory );
return FT_Err_Ok;
}