summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2022-07-29 22:42:22 +0200
committerWerner Lemberg <wl@gnu.org>2022-07-29 22:57:18 +0200
commit2af6903b15495c9c472faf4b243be7ba75eeaeb5 (patch)
treeca0911cf540469c68adf5b9ff15b48768f8a184c
parenta3749a64cd0c5bbec8222ec059a87bdcb114a4f5 (diff)
downloadfreetype2-2af6903b15495c9c472faf4b243be7ba75eeaeb5.tar.gz
* src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error.
-rw-r--r--include/freetype/ftglyph.h6
-rw-r--r--src/base/ftglyph.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h
index 6b77bd3d2..b9235463f 100644
--- a/include/freetype/ftglyph.h
+++ b/include/freetype/ftglyph.h
@@ -355,7 +355,7 @@ FT_BEGIN_HEADER
*
* @output:
* aglyph ::
- * A handle to the glyph object.
+ * A handle to the glyph object. `NULL` in case of error.
*
* @return:
* FreeType error code. 0~means success.
@@ -385,7 +385,7 @@ FT_BEGIN_HEADER
*
* @output:
* target ::
- * A handle to the target glyph object. 0~in case of error.
+ * A handle to the target glyph object. `NULL` in case of error.
*
* @return:
* FreeType error code. 0~means success.
@@ -671,7 +671,7 @@ FT_BEGIN_HEADER
*
* @input:
* glyph ::
- * A handle to the target glyph object.
+ * A handle to the target glyph object. Can be `NULL`.
*/
FT_EXPORT( void )
FT_Done_Glyph( FT_Glyph glyph );
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 571dca1a9..5873438cd 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -682,7 +682,10 @@
Exit2:
/* if an error occurred, destroy the glyph */
if ( error )
+ {
FT_Done_Glyph( glyph );
+ *aglyph = NULL;
+ }
else
*aglyph = glyph;