diff options
author | Lei Zhang <thestig@chromium.org> | 2015-05-08 11:33:26 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-05-08 11:33:26 -0700 |
commit | 470408c2ffe71e99cebad0d1d6887f1723f02cef (patch) | |
tree | 23bb5ed2651e093c6090aab0575ebfbbce74a983 | |
parent | f0a169e6fd5718995fa6ef8749c8d16cdad84985 (diff) | |
download | pdfium-470408c2ffe71e99cebad0d1d6887f1723f02cef.tar.xz |
Fix errors from commit f0a169e.
- fread() returns the number of items read.
- fix a memory leak in error handling.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1135713004
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 0596c12f4c..f058f03bce 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -1367,7 +1367,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) FX_BYTE buffer[16]; FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); - if (readCnt != 12) { + if (readCnt != 1) { FXSYS_fclose(pFile); return; } @@ -1386,6 +1386,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) } readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); if (readCnt != face_bytes) { + FX_Free(offsets); FXSYS_fclose(pFile); return; } |