emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 32910a0ef05 1/2: Fix file descriptor leaks


From: Po Lu
Subject: feature/android 32910a0ef05 1/2: Fix file descriptor leaks
Date: Sat, 28 Jan 2023 02:26:55 -0500 (EST)

branch: feature/android
commit 32910a0ef0564052afb37d6675a1631bb54cdb0c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix file descriptor leaks
    
    * src/sfntfont.c (sfntfont_read_cmap):
    (sfntfont_open): Fix leaks of file descriptors.
---
 src/sfntfont.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/sfntfont.c b/src/sfntfont.c
index 87f93473ff3..d9b152e27eb 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -927,7 +927,7 @@ sfntfont_read_cmap (struct sfnt_font_desc *desc,
 
   if (!font)
     {
-      close (fd);
+      emacs_close (fd);
       return;
     }
 
@@ -937,7 +937,7 @@ sfntfont_read_cmap (struct sfnt_font_desc *desc,
 
   if (!table)
     {
-      close (fd);
+      emacs_close (fd);
       return;
     }
 
@@ -957,6 +957,7 @@ sfntfont_read_cmap (struct sfnt_font_desc *desc,
   xfree (data);
   xfree (subtables);
   xfree (table);
+  emacs_close (fd);
 }
 
 /* Look up a character CHARACTER in the font description DESC.  Cache
@@ -2026,6 +2027,9 @@ sfntfont_open (struct frame *f, Lisp_Object font_entity,
   /* Calculate the xfld name.  */
   font->props[FONT_NAME_INDEX] = Ffont_xlfd_name (font_object, Qnil);
 
+  /* Close the font file descriptor.  */
+  emacs_close (fd);
+
   /* All done.  */
   unblock_input ();
   return font_object;
@@ -2058,7 +2062,7 @@ sfntfont_open (struct frame *f, Lisp_Object font_entity,
  bail2:
   xfree (subtable);
  bail1:
-  close (fd);
+  emacs_close (fd);
  bail:
   unblock_input ();
   return Qnil;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]