diff options
author | Pedro Giffuni <pfg@apache.org> | 2015-11-29 20:39:42 +0000 |
---|---|---|
committer | Pedro Giffuni <pfg@apache.org> | 2015-11-29 20:39:42 +0000 |
commit | bbbba78518a700ed7fc9c25d232543ea49a605ec (patch) | |
tree | 81a08daa347943057244f4e4daa7f872036c0717 /vcl | |
parent | 5eb9efa7e3aadc229d2ae260601aa05abfed0076 (diff) |
Resource Leak
CID: 705772
Notes
Notes:
prefer: 059dfe015f2b44eaf8126c1a747e6d4407dda131
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/fontsubset/ttcr.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 84dfe2d01421..0d22a2e4eb75 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -394,9 +394,10 @@ int StreamToFile(TrueTypeCreator *_this, const char* fname) FILE* fd; if ((r = StreamToMemory(_this, &ptr, &length)) != SF_OK) return r; - if (!fname) return SF_BADFILE; - if ((fd = fopen(fname, "wb")) == NULL) return SF_BADFILE; - + if ((!fname) || (fd = fopen(fname, "wb")) == NULL)) { + free(ptr); + return SF_BADFILE; + } if (fwrite(ptr, 1, length, fd) != length) { r = SF_FILEIO; } else { |