You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2015/11/29 21:39:42 UTC

svn commit: r1717119 - /openoffice/trunk/main/vcl/source/fontsubset/ttcr.cxx

Author: pfg
Date: Sun Nov 29 20:39:42 2015
New Revision: 1717119

URL: http://svn.apache.org/viewvc?rev=1717119&view=rev
Log:
Resource Leak

CID:	705772

Modified:
    openoffice/trunk/main/vcl/source/fontsubset/ttcr.cxx

Modified: openoffice/trunk/main/vcl/source/fontsubset/ttcr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/fontsubset/ttcr.cxx?rev=1717119&r1=1717118&r2=1717119&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/fontsubset/ttcr.cxx (original)
+++ openoffice/trunk/main/vcl/source/fontsubset/ttcr.cxx Sun Nov 29 20:39:42 2015
@@ -394,9 +394,10 @@ int StreamToFile(TrueTypeCreator *_this,
     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 {