aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-01-28 15:25:29 +0800
committerPo Lu2023-01-28 15:25:29 +0800
commit32910a0ef0564052afb37d6675a1631bb54cdb0c (patch)
tree92655ed9c809b388a9e9fc4e910734ea94801f66 /src
parent6f2a518f2728bdad24161c04476c5f95c60b6f55 (diff)
downloademacs-32910a0ef0564052afb37d6675a1631bb54cdb0c.tar.gz
emacs-32910a0ef0564052afb37d6675a1631bb54cdb0c.zip
Fix file descriptor leaks
* src/sfntfont.c (sfntfont_read_cmap): (sfntfont_open): Fix leaks of file descriptors.
Diffstat (limited to 'src')
-rw-r--r--src/sfntfont.c10
1 files 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,
927 927
928 if (!font) 928 if (!font)
929 { 929 {
930 close (fd); 930 emacs_close (fd);
931 return; 931 return;
932 } 932 }
933 933
@@ -937,7 +937,7 @@ sfntfont_read_cmap (struct sfnt_font_desc *desc,
937 937
938 if (!table) 938 if (!table)
939 { 939 {
940 close (fd); 940 emacs_close (fd);
941 return; 941 return;
942 } 942 }
943 943
@@ -957,6 +957,7 @@ sfntfont_read_cmap (struct sfnt_font_desc *desc,
957 xfree (data); 957 xfree (data);
958 xfree (subtables); 958 xfree (subtables);
959 xfree (table); 959 xfree (table);
960 emacs_close (fd);
960} 961}
961 962
962/* Look up a character CHARACTER in the font description DESC. Cache 963/* Look up a character CHARACTER in the font description DESC. Cache
@@ -2026,6 +2027,9 @@ sfntfont_open (struct frame *f, Lisp_Object font_entity,
2026 /* Calculate the xfld name. */ 2027 /* Calculate the xfld name. */
2027 font->props[FONT_NAME_INDEX] = Ffont_xlfd_name (font_object, Qnil); 2028 font->props[FONT_NAME_INDEX] = Ffont_xlfd_name (font_object, Qnil);
2028 2029
2030 /* Close the font file descriptor. */
2031 emacs_close (fd);
2032
2029 /* All done. */ 2033 /* All done. */
2030 unblock_input (); 2034 unblock_input ();
2031 return font_object; 2035 return font_object;
@@ -2058,7 +2062,7 @@ sfntfont_open (struct frame *f, Lisp_Object font_entity,
2058 bail2: 2062 bail2:
2059 xfree (subtable); 2063 xfree (subtable);
2060 bail1: 2064 bail1:
2061 close (fd); 2065 emacs_close (fd);
2062 bail: 2066 bail:
2063 unblock_input (); 2067 unblock_input ();
2064 return Qnil; 2068 return Qnil;