summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-02-24 12:39:07 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-02-24 12:39:07 +0000
commit5c60c08dc221f0c2771e08f2b80607cb52f4845f (patch)
tree4fa85340f16c20ed807fc275e7f6accd97216d7e /Build
parent0ddb97906a4aca3d70e051d8491cbfc0c82bca67 (diff)
texk/dvipdfm-x: Fix a small memory leak
git-svn-id: svn://tug.org/texlive/trunk@36368 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog4
-rw-r--r--Build/source/texk/dvipdfm-x/dvi.c18
2 files changed, 11 insertions, 11 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index e03a2b29c33..f7dbbb63e73 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,6 +1,8 @@
2015-02-24 Peter Breitenlohner <peb@mppmu.mpg.de>
- * dvi.c (dvi_locate_native_font): Avoid buffer overflow.
+ * dvi.c (dvi_locate_native_font): Avoid sprintf() buffer overrun.
+
+ * dvi.c (dvi_locate_native_font): Fix a small memory leak.
2015-02-21 Khaled Hosny <khaledhosny@eglug.org>
diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c
index f0dd4393d0c..1c8b2f38eff 100644
--- a/Build/source/texk/dvipdfm-x/dvi.c
+++ b/Build/source/texk/dvipdfm-x/dvi.c
@@ -923,7 +923,7 @@ dvi_locate_native_font (const char *filename, uint32_t index,
fontmap_rec *mrec;
char *fontmap_key;
FILE *fp;
- char *path = strdup(filename);
+ char *path;
sfnt *sfont;
unsigned offset = 0;
struct tt_head_table *head;
@@ -933,15 +933,13 @@ dvi_locate_native_font (const char *filename, uint32_t index,
if (verbose)
MESG("<%s@%.2fpt", filename, ptsize * dvi2pts);
- fp = fopen(path, "rb");
- if (!fp &&
- ((path = dpx_find_opentype_file(filename)) != NULL
- || (path = dpx_find_truetype_file(filename)) != NULL
- || (path = dpx_find_type1_file(filename)) != NULL
- || (path = dpx_find_dfont_file(filename)) != NULL) ) {
- fp = fopen(path, "rb");
- }
- if (!fp) {
+ if ((fp = fopen(filename, "rb")) != NULL)
+ path = strdup(filename);
+ else if (((path = dpx_find_opentype_file(filename)) == NULL
+ && (path = dpx_find_truetype_file(filename)) == NULL
+ && (path = dpx_find_type1_file(filename)) == NULL
+ && (path = dpx_find_dfont_file(filename)) == NULL)
+ || (fp = fopen(path, "rb")) == NULL) {
ERROR("Cannot proceed without the font: %s", filename);
}
need_more_fonts(1);