From 1c70a4b8f5f1cbedb054efceff891e9bd81e111d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 18 2021 07:02:19 +0000 Subject: import fontforge-20200314-5.el8 --- diff --git a/.fontforge.metadata b/.fontforge.metadata index 426fa04..c6e6c1d 100644 --- a/.fontforge.metadata +++ b/.fontforge.metadata @@ -1,2 +1 @@ -f7afd824640ed620790a20b14eb78b1e230fea10 SOURCES/fontforge-20170731.tar.gz -13b702314f26b56b81dc55adfe29468957002141 SOURCES/gnulib-2bf7326.tar.gz +cca54440dd47414055507a5007cd9b663699f3e2 SOURCES/fontforge-20200314.tar.gz diff --git a/.gitignore b/.gitignore index 70c1bea..17fbee8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -SOURCES/fontforge-20170731.tar.gz -SOURCES/gnulib-2bf7326.tar.gz +SOURCES/fontforge-20200314.tar.gz diff --git a/SOURCES/Add-python3-support.patch b/SOURCES/Add-python3-support.patch deleted file mode 100644 index 32759fa..0000000 --- a/SOURCES/Add-python3-support.patch +++ /dev/null @@ -1,519 +0,0 @@ -From b2c5de7835a753cad1f35db8202c4733b5fc2990 Mon Sep 17 00:00:00 2001 -From: Parag A Nemade -Date: Mon, 3 Oct 2016 12:56:29 +0530 -Subject: [PATCH] Add python3 support - -Signed-off-by: Parag A Nemade ---- - pycontrib/FontCompare/fc/BitmapHandler.py | 20 +++++++-------- - pycontrib/FontCompare/fc/DocCompare.py | 2 +- - pycontrib/FontCompare/fc/FontCompare.py | 2 +- - pycontrib/FontCompare/fc/GlyphConsistency.py | 2 +- - pycontrib/FontCompare/fontcompare | 2 +- - pycontrib/FontCompare/unittests/unittests.py | 18 ++++++------- - pycontrib/collab/web-test-collab.py | 2 +- - pycontrib/even.py | 2 +- - pycontrib/gdraw/__init__.py | 4 +-- - pycontrib/gdraw/gdraw.py | 20 +++++++-------- - pycontrib/graphicore.py | 4 +-- - pycontrib/graphicore/ipython_view.py | 13 +++++----- - pycontrib/graphicore/shell.py | 4 +-- - pycontrib/svg2sfd.py | 38 ++++++++++++++-------------- - pycontrib/webcollab.py | 6 ++--- - 15 files changed, 70 insertions(+), 69 deletions(-) - -diff --git a/pycontrib/FontCompare/fc/BitmapHandler.py b/pycontrib/FontCompare/fc/BitmapHandler.py -index d4d00da..c159128 100644 ---- a/pycontrib/FontCompare/fc/BitmapHandler.py -+++ b/pycontrib/FontCompare/fc/BitmapHandler.py -@@ -35,7 +35,7 @@ def white_bg_square(img): - "return a white-background-color image having the img in exact center" - size = (max(img.size),)*2 - layer = Image.new('1', size, 1) -- layer.paste(img, tuple(map(lambda x:(x[0]-x[1])/2, zip(size, img.size)))) -+ layer.paste(img, tuple([(x[0]-x[1])/2 for x in zip(size, img.size)])) - return layer - - class BitmapCompare: -@@ -73,13 +73,13 @@ class CreateSpriteSheet: - #seperate each image with lots of whitespace - master_height = pixelsize - oldfont = font -- print "the master image will by %d by %d" % (master_width, master_height) -- print "creating image..." -+ print("the master image will by %d by %d" % (master_width, master_height)) -+ print("creating image...") - master = Image.new( - mode='1', - size=(master_width, master_height), - color=0) # fully transparent -- print "created." -+ print("created.") - if effects == "italic": - font.selection.all() - font = font.italicize(-13) -@@ -92,16 +92,16 @@ class CreateSpriteSheet: - font[i].changeWeight(50,"auto",0,0,"auto") - font[i].export("temp.bmp",pixelsize,1) - img = Image.open("temp.bmp") -- print "adding %s at %d..." % (str(i)+".bmp", location), -+ print("adding %s at %d..." % (str(i)+".bmp", location), end=' ') - square_one = white_bg_square(img) - square_one.resize((pixelsize, pixelsize)) - master.paste(square_one,(location,0)) -- print "added." -+ print("added.") - except: -- print "ooopsy" -+ print("ooopsy") - count+=1 -- print "done adding pics." -- print "saving mastersprite.bmp..." -+ print("done adding pics.") -+ print("saving mastersprite.bmp...") - master.save('data/mastersprite'+effects+'.bmp' ) -- print "saved!" -+ print("saved!") - font.close() -diff --git a/pycontrib/FontCompare/fc/DocCompare.py b/pycontrib/FontCompare/fc/DocCompare.py -index 3a54bf9..df431e2 100644 ---- a/pycontrib/FontCompare/fc/DocCompare.py -+++ b/pycontrib/FontCompare/fc/DocCompare.py -@@ -41,7 +41,7 @@ class DocCompare: - bashcommand = "hb-view --output-format=\"png\" --output-file=\"/var/tmp/test.png\" --font-size="+str(fontsize)+" --text-file=\"" - bashcommand+=docpath+"\" "+"\""+testpath+"\"" - os.system(str(bashcommand)) -- print bashcommand -+ print(bashcommand) - thefile = pkg_resources.resource_filename("fc",mockfont.highresdocfile) - shutil.copy(thefile,"/var/tmp/standard.png") - cm = BitmapCompare() -diff --git a/pycontrib/FontCompare/fc/FontCompare.py b/pycontrib/FontCompare/fc/FontCompare.py -index f21718c..c82b788 100644 ---- a/pycontrib/FontCompare/fc/FontCompare.py -+++ b/pycontrib/FontCompare/fc/FontCompare.py -@@ -111,7 +111,7 @@ class FontCompare(object): - scores = list() - comparator = BitmapCompare() - pixelsize = (resolution*ptsize)/72 -- print spritepath -+ print(spritepath) - for i in range (glyphRange[0],glyphRange[1]): - if i in Testfont: - Testfont[i].export("/var/tmp/tmp.bmp",pixelsize,1) -diff --git a/pycontrib/FontCompare/fc/GlyphConsistency.py b/pycontrib/FontCompare/fc/GlyphConsistency.py -index 38273c9..d5265fa 100644 ---- a/pycontrib/FontCompare/fc/GlyphConsistency.py -+++ b/pycontrib/FontCompare/fc/GlyphConsistency.py -@@ -102,7 +102,7 @@ class GlyphConsistency: - for i in range (glyphrange[0],glyphrange[1]): - if i in font: - score = self.glyph_round_compare(font[i],pixelsize) -- print score -+ print(score) - set_round_score+=score - total+=1 - font.close() -diff --git a/pycontrib/FontCompare/fontcompare b/pycontrib/FontCompare/fontcompare -index e7e68d8..fdf7336 100755 ---- a/pycontrib/FontCompare/fontcompare -+++ b/pycontrib/FontCompare/fontcompare -@@ -15,7 +15,7 @@ - along with this program. If not, see . - """ - --#! /usr/bin/python -+#! /usr/bin/python3 - from PyQt4.QtGui import QMessageBox - from PyQt4.QtGui import QMainWindow - from PyQt4.QtGui import QApplication -diff --git a/pycontrib/FontCompare/unittests/unittests.py b/pycontrib/FontCompare/unittests/unittests.py -index 18e1e95..d8a1190 100644 ---- a/pycontrib/FontCompare/unittests/unittests.py -+++ b/pycontrib/FontCompare/unittests/unittests.py -@@ -55,7 +55,7 @@ class Basictests(unittest.TestCase): - for tup in basic: - if tup[1]!=10: - bastest=0 -- self.failUnless(bastest) -+ self.assertTrue(bastest) - testfont = fontforge.open("unittests/lohit.ttf") - bold = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\ - 600,12,1,"bold") -@@ -66,28 +66,28 @@ class Basictests(unittest.TestCase): - normal = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\ - 600,12,1,"normal") - test = 1 -- print len(normal) -+ print(len(normal)) - for tup in bold: - if tup[1]==100 or tup[1]==0: - test1=1 - break -- self.failUnless(test) -+ self.assertTrue(test) - test = 0 - for tup in italic: - if tup[1]==100 or tup[1]==0: - test=1 - break -- self.failUnless(test is 1) -+ self.assertTrue(test is 1) - test = 0 - for tup in normal: - if tup[1]==100 or tup[1]==0: - test=1 - break -- self.failUnless(test is 1) -+ self.assertTrue(test is 1) - test = 0 - if len(normal) == len(bold) == len(italic): - test = 1 -- self.failUnless(test is 1) -+ self.assertTrue(test is 1) - - def testGlyphConsistency(self): - cm = GlyphConsistency() -@@ -99,11 +99,11 @@ class Basictests(unittest.TestCase): - test3 = cm.glyph_round_consistency(testfont,(0x900,0x97f),50) - - test = (0 <= test1[0][1] <= 10) -- self.failUnless(test) -+ self.assertTrue(test) - test2 = (0 <= test2 <= 10) -- self.failUnless(test2) -+ self.assertTrue(test2) - test3 = (0 <= test3 <= 10) -- self.failUnless(test3) -+ self.assertTrue(test3) - - """ - unittests for DocCompare not required. -diff --git a/pycontrib/collab/web-test-collab.py b/pycontrib/collab/web-test-collab.py -index 47b763f..b19f930 100755 ---- a/pycontrib/collab/web-test-collab.py -+++ b/pycontrib/collab/web-test-collab.py -@@ -68,7 +68,7 @@ def OnCollabUpdate(f): - "end": "null" # this is simply so we dont have to manage keeping the last item with no terminating , - }, - sort_keys=True, indent=4, separators=(',', ': ')) -- print js -+ print(js) - fi = open(fontJsonOnDisk, 'w') - fi.write(js) - -diff --git a/pycontrib/even.py b/pycontrib/even.py -index 96f9128..4f30fcb 100755 ---- a/pycontrib/even.py -+++ b/pycontrib/even.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # -*- coding: utf-8 -*- - """ - running even from the fontforge menu -diff --git a/pycontrib/gdraw/__init__.py b/pycontrib/gdraw/__init__.py -index d47976c..dde7ea8 100644 ---- a/pycontrib/gdraw/__init__.py -+++ b/pycontrib/gdraw/__init__.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # vim:ts=8:sw=4:expandtab:encoding=utf-8 - ''' - Copyright 2009 -@@ -22,7 +22,7 @@ Copyright 2009 - __all__ = ['Timer', 'GtkRunner', 'gtkrunner'] - __version__ = '0.1' - --from gdraw import * -+from .gdraw import * - - def main(): - pass -diff --git a/pycontrib/gdraw/gdraw.py b/pycontrib/gdraw/gdraw.py -index f2d5e50..8b6e693 100755 ---- a/pycontrib/gdraw/gdraw.py -+++ b/pycontrib/gdraw/gdraw.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - '''ctypes wrapper to Attach the GDraw event handler to the gtk main loop. - - Copyright 2009 -@@ -67,7 +67,7 @@ def setup_syspath(modpath="modules"): - - __all__ = ['Timer', 'GtkRunner', 'gtkrunner'] - --from _gdraw import * -+from ._gdraw import * - from ctypes import * - import types - -@@ -111,7 +111,7 @@ class Timer: - - return - def dodo(*args): -- print 'aaa' -+ print('aaa') - return False - self.add(1000, dodo) - -@@ -122,7 +122,7 @@ class Timer: - - def _event_handler(self, gw, event): - evt = event.contents -- print "_event_handler()" -+ print("_event_handler()") - if evt.type == et_timer: - timer = evt.u.timer.timer - tkey = addressof(timer.contents) -@@ -147,7 +147,7 @@ class Timer: - ci.func = CallBackFunc(func) - ci.data = data - -- print "timer.add timeout", timeout -+ print("timer.add timeout", timeout) - frequency = 1 # Use return value of func() to decide repeat like gtk. - timer = GDrawRequestTimer(self.win, timeout, timeout, byref(ci)) - -@@ -190,7 +190,7 @@ class GtkRunner: - - def _do_main(self, *args): - '''The function called by the gdraw timeout handler.''' -- print "do_main" -+ print("do_main") - while gtk.events_pending(): - gtk.main_iteration(False) - return True -@@ -207,15 +207,15 @@ class GtkRunner: - self.gtk_timer = None - - def OnDestroyWindow(self, widget, fd ): -- print fd -+ print(fd) - fontforge.removeGtkWindowToMainEventLoopByFD( fd ) - self.stop() - return True - - def sniffwindow(self,w): - '''sniff key presses for a gtk window''' -- print "sniffwindow w", w -- print "sniff active font:", fontforge.activeFont() -+ print("sniffwindow w", w) -+ print("sniff active font:", fontforge.activeFont()) - w.connect("key-release-event", self._do_main) - fontforge.addGtkWindowToMainEventLoop(w.window.xid) - fd = fontforge.getGtkWindowMainEventLoopFD(w.window.xid) -@@ -223,7 +223,7 @@ class GtkRunner: - - def sniffwindowid(self,xid): - '''sniff key presses for a gtk window''' -- print "sniffwindowid xid", xid -+ print("sniffwindowid xid", xid) - #w.connect("key-release-event", self._do_main) - - def start(self, timeout=GTIMEOUT): -diff --git a/pycontrib/graphicore.py b/pycontrib/graphicore.py -index f95e488..229a2b7 100755 ---- a/pycontrib/graphicore.py -+++ b/pycontrib/graphicore.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # -*- coding: utf-8 -*- - """ - running the fontforge scripts in the graphicore folder on fontforge startup -@@ -22,4 +22,4 @@ sys.path.append(os.path.dirname(sys.modules[__name__].__file__)) - sys.path.reverse(); - - #load the modules --import graphicore.shell -\ No newline at end of file -+import graphicore.shell -diff --git a/pycontrib/graphicore/ipython_view.py b/pycontrib/graphicore/ipython_view.py -index f39eedb..2b77395 100644 ---- a/pycontrib/graphicore/ipython_view.py -+++ b/pycontrib/graphicore/ipython_view.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - ''' - Provides IPython console widget. - -@@ -17,10 +17,11 @@ import re - import sys - import os - import pango --from StringIO import StringIO --import thread -+from io import StringIO -+import _thread - - import IPython -+from functools import reduce - - class IterableIPShell: - ''' -@@ -118,7 +119,7 @@ class IterableIPShell: - ''' - This function updates namespace with sys.modules - ''' -- for k,v in sys.modules.items(): -+ for k,v in list(sys.modules.items()): - if not '.' in k: - self.IP.user_ns.update({k:v}) - -@@ -271,11 +272,11 @@ class IterableIPShell: - @type header: string - ''' - stat = 0 -- if verbose or debug: print header+cmd -+ if verbose or debug: print(header+cmd) - # flush stdout so we don't mangle python's buffering - if not debug: - input, output = os.popen4(cmd) -- print output.read() -+ print(output.read()) - output.close() - input.close() - -diff --git a/pycontrib/graphicore/shell.py b/pycontrib/graphicore/shell.py -index 5d102f7..32fa584 100755 ---- a/pycontrib/graphicore/shell.py -+++ b/pycontrib/graphicore/shell.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # -*- coding: utf-8 -*- - """ - FontForge Interactive Python Shell -@@ -32,7 +32,7 @@ if len(sys.argv) == 0: - # some versions of IPython need content in sys.argv - sys.argv.append('') - --from ipython_view import * -+from .ipython_view import * - import gdraw - - def runShell(data = None, glyphOrFont = None): -diff --git a/pycontrib/svg2sfd.py b/pycontrib/svg2sfd.py -index e1fc0ac..e23cb15 100644 ---- a/pycontrib/svg2sfd.py -+++ b/pycontrib/svg2sfd.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # - # Copyright 2013 Google Inc. All rights reserved. - # -@@ -49,7 +49,7 @@ def print_one_cmd(cmd, args): - result.append('%f' % (scale * args[i])) - result.append(cmd) - result.append('0') # TODO: should mark corner points -- print ' '.join(result) -+ print(' '.join(result)) - - def apply_rel_xy(xy, args): - x0, y0 = xy -@@ -75,7 +75,7 @@ def path_to_sfd(path): - for i in range(num_args_cmd(cmd)): - m = fre.match(path) - if m is None: -- print 'no float match:', path -+ print('no float match:', path) - args.append(float(m.group(1))) - path = path[m.end():] - #print cmd, args -@@ -128,13 +128,13 @@ def conv_svg(fn, char, glyphnum = None): - if glyphnum == None: - glyphnum = lastglyphnum + 1 - lastglyphnum = glyphnum -- print 'StartChar:', os.path.basename(fn)[:-4] -- print 'Encoding: %d %d %d' % (char, glyphnum, char) -- print 'Width: %d' % (21 * 40) -- print 'Flags: W' -- print 'LayerCount: 2' -- print 'Fore' -- print 'SplineSet' -+ print('StartChar:', os.path.basename(fn)[:-4]) -+ print('Encoding: %d %d %d' % (char, glyphnum, char)) -+ print('Width: %d' % (21 * 40)) -+ print('Flags: W') -+ print('LayerCount: 2') -+ print('Fore') -+ print('SplineSet') - doc = xml.dom.minidom.parse(fn) - # TODO: reverse paths if fill color is white-ish (this is more code, - # and in the meantime, we'll rely on correct path direction in FF) -@@ -147,16 +147,16 @@ def conv_svg(fn, char, glyphnum = None): - cy = float(circle.getAttribute('cy')) - r = float(circle.getAttribute('r')) - circle_to_sfd(cx, cy, r) -- print 'EndSplineSet' -- print 'EndChar' -+ print('EndSplineSet') -+ print('EndChar') - - def print_header(): - global header_printed -- print '''SplineFontDB: 3.0 -+ print('''SplineFontDB: 3.0 - FontName: %s - FullName: %s --FamilyName: %s''' % (font_name, font_name, font_name) -- print '''Weight: Medium -+FamilyName: %s''' % (font_name, font_name, font_name)) -+ print('''Weight: Medium - Copyright: Copyright (C) 2011 Google Inc. - Version: 001.000 - UnderlinePosition: -120 -@@ -180,12 +180,12 @@ HheadAOffset: 0 - HheadDescent: 200 - HheadDOffset: 0 - BeginChars: 57600 57600 --''' -+''') - header_printed = True - - def print_footer(): -- print '''EndChars --EndSplineFont''' -+ print('''EndChars -+EndSplineFont''') - - def parse_int(x): - if x.startswith('0x'): -@@ -197,7 +197,7 @@ def run_file(fn): - global char_num - global font_name - directory = '' -- for l in file(fn).xreadlines(): -+ for l in file(fn): - if l.startswith('#'): - continue - s = l.strip().split() -diff --git a/pycontrib/webcollab.py b/pycontrib/webcollab.py -index 9ee0f17..4be07ec 100755 ---- a/pycontrib/webcollab.py -+++ b/pycontrib/webcollab.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # -*- coding: utf-8 -*- - """ - running web collab server hooks -@@ -44,8 +44,8 @@ def startWebServerInCollabMode(data = None, glyphOrFont = None): - global child - global childNodejs - ensureChildClosed() -- print("FONTFORGE:" + FONTFORGE) -- print("script path:" + collabpath + "web-test-collab.py") -+ print(("FONTFORGE:" + FONTFORGE)) -+ print(("script path:" + collabpath + "web-test-collab.py")) - child = subprocess.Popen( [ FONTFORGE, "-forceuihidden", "-script", collabpath + "web-test-collab.py" ] ) - # - # start the nodejs server --- -2.9.3 - diff --git a/SOURCES/fontforge-20140813-use-system-uthash.patch b/SOURCES/fontforge-20140813-use-system-uthash.patch deleted file mode 100644 index e5a0b4b..0000000 --- a/SOURCES/fontforge-20140813-use-system-uthash.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- ./Makefile.am.old 2014-08-12 10:07:32.000000000 +0530 -+++ ./Makefile.am 2014-09-08 16:23:56.046996941 +0530 -@@ -43,7 +43,6 @@ - AM_CPPFLAGS = - AM_LDFLAGS = - --BUILT_SOURCES = uthash/src - EXTRA_DIST = - CLEANFILES = - MOSTLYCLEANFILES = -@@ -113,7 +112,6 @@ - Packaging/FontForge-doc.spec \ - Packaging/FontForge.spec \ - Packaging/FontForge.static.spec \ -- uthash/src \ - $(NULL) - - #-------------------------------------------------------------------------- -@@ -129,11 +127,6 @@ - - - #-------------------------------------------------------------------------- --uthash/src: -- if [ ! -e uthash/src ]; then \ -- if [ -e uthash ] ; then rm -r uthash ; fi ; \ -- git clone https://github.com/troydhanson/uthash ; \ -- fi ; - - # We import a selection of targets from Frank's standard packaging Makefile. - diff --git a/SOURCES/fontforge-20170731-covscan-issue-fix.patch b/SOURCES/fontforge-20170731-covscan-issue-fix.patch deleted file mode 100644 index 27999c4..0000000 --- a/SOURCES/fontforge-20170731-covscan-issue-fix.patch +++ /dev/null @@ -1,2666 +0,0 @@ -diff -urN fontforge-20170731.old/fontforge/asmfpst.c fontforge-20170731/fontforge/asmfpst.c ---- fontforge-20170731.old/fontforge/asmfpst.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/asmfpst.c 2018-09-23 14:50:31.558567689 +0530 -@@ -810,13 +810,16 @@ - match_len = j; - - for ( i=0; i=max ) -@@ -251,6 +255,8 @@ - } else { - if ( fscanf(plate,"%lg %lg )", &spiros[cnt].x, &spiros[cnt].y)!=2 ) { - ff_post_error( _("Not a plate file"), _("This does not seem to be a plate file\nExpected two real numbers")); -+ free(head); -+ free(spiros); - return; - } - ++cnt; -diff -urN fontforge-20170731.old/fontforge/cvundoes.c fontforge-20170731/fontforge/cvundoes.c ---- fontforge-20170731.old/fontforge/cvundoes.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/cvundoes.c 2018-09-23 14:50:31.559567674 +0530 -@@ -2637,6 +2637,7 @@ - adjust->yadv.corrections = malloc(adjust->yadv.last_pixel_size-adjust->yadv.first_pixel_size+1); - memcpy(adjust->yadv.corrections,vr->adjust->yadv.corrections,adjust->yadv.last_pixel_size-adjust->yadv.first_pixel_size+1); - } -+ free(adjust); - } - - static void PSTInto(SplineChar *sc,PST *pst,PST *frompst, struct lookup_subtable *sub) { -@@ -3898,6 +3899,7 @@ - { - char* str = UndoToString( sc, undo ); - printf("\n\n*** undo: %d\n%s\n", idx, str ); -+ free(str); - } - printf("dumpUndoChain(end) %s\n", msg ); - } -diff -urN fontforge-20170731.old/fontforge/encoding.c fontforge-20170731/fontforge/encoding.c ---- fontforge-20170731.old/fontforge/encoding.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/encoding.c 2018-09-23 14:50:31.560567658 +0530 -@@ -757,6 +757,7 @@ - if ( item->enc_name==NULL ) { - if ( no_windowing_ui ) { - ff_post_error(_("Bad encoding file format"),_("This file contains an unnamed encoding, which cannot be named in a script")); -+ free(head); - return( NULL ); - } - if ( item==head && item->next==NULL ) -diff -urN fontforge-20170731.old/fontforge/featurefile.c fontforge-20170731/fontforge/featurefile.c ---- fontforge-20170731.old/fontforge/featurefile.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/featurefile.c 2018-09-23 14:50:31.561567642 +0530 -@@ -1620,9 +1620,10 @@ - glyphs[lcnt].sc = NULL; - } - -- if ( !needsclasses && lcnt==0 && sf->mark_class_cnt==0 ) -+ if ( !needsclasses && lcnt==0 && sf->mark_class_cnt==0 ){ -+ free(glyphs); - return; /* No anchor positioning, no ligature carets */ -- -+ } - if ( sf->mark_class_cnt!=0 ) { - fprintf( out, "#Mark attachment classes (defined in GDEF, used in lookupflags)\n" ); - for ( i=1; imark_class_cnt; ++i ) { -@@ -1799,9 +1800,12 @@ - } - } - } -+ free(langs); - } - } -+ free(scripts); - } -+ free(feats); - } - if (has_DFLT) { dump_header_languagesystem_hash_fe((gpointer)"DFLT dflt", (gpointer)"", (gpointer)out); } - g_tree_foreach( ht, dump_header_languagesystem_hash_fe, out ); -@@ -3259,15 +3263,18 @@ - LogError(_("Expected '=' in glyph class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] ); - ++tok->err_count; - fea_skip_to_semi(tok); -+ free(classname); - return; - } - fea_ParseTok(tok); - contents = fea_ParseGlyphClass(tok); // Make a list of referenced glyphs. - if ( contents==NULL ) { - fea_skip_to_semi(tok); -+ free(contents); - return; - } - fea_AddClassDef(tok,classname,copy(contents)); // Put the list into a class. -+ free(contents); - fea_end_statement(tok); - } - -@@ -3517,6 +3524,7 @@ - LogError(_("Expected name in anchor definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] ); - ++tok->err_count; - fea_skip_to_semi(tok); -+ free(ap); - return; - } - for ( nap=tok->namedAnchors; nap!=NULL; nap=nap->next ) -@@ -3681,6 +3689,7 @@ - LogError(_("Expected class name in mark class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] ); - ++tok->err_count; - fea_skip_to_semi(tok); -+ free(ap); - return; - } - gm = chunkalloc(sizeof(*gm)); -@@ -7092,6 +7101,7 @@ - } - if ( f!=NULL && f->type == ft_feat_end ) - f = f->next; -+ free(sl); - return( f ); - } - -diff -urN fontforge-20170731.old/fontforge/glyphcomp.c fontforge-20170731/fontforge/glyphcomp.c ---- fontforge-20170731.old/fontforge/glyphcomp.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/glyphcomp.c 2018-09-23 14:50:31.562567627 +0530 -@@ -1414,7 +1414,10 @@ - - static void NameCompare(struct font_diff *fd,const char *name1, const char *name2, char *id) { - -- if (!name1) name1=""; if (!name2) name2=""; -+ if (!name1) -+ name1=""; -+ if (!name2) -+ name2=""; - if ( strcmp(name1,name2)!=0 ) { - if ( !fd->top_diff ) - fprintf( fd->diffs, "Names\n" ); -@@ -1442,7 +1445,10 @@ - int lang,int strid) { - char strnamebuf[200]; - -- if (!name1) name1=""; if (!name2) name2=""; -+ if (!name1) -+ name1=""; -+ if (!name2) -+ name2=""; - if ( strcmp(name1,name2)==0 ) - return; - sprintf( strnamebuf, "%.90s %.90s", TTFNameIds(strid), MSLangString(lang)); -diff -urN fontforge-20170731.old/fontforge/http.c fontforge-20170731/fontforge/http.c ---- fontforge-20170731.old/fontforge/http.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/http.c 2018-09-23 14:50:31.562567627 +0530 -@@ -540,7 +540,9 @@ - if ( !findFTPhost(&addr, host, port)) { - ff_progress_end_indicator(); - ff_post_error(_("Could not find host"),_("Could not find \"%s\"\nAre you connected to the internet?"), host ); -- free( host ); free( filename ); -+ free( host ); -+ free( filename ); -+ free(password); - return( false ); - } - soc = makeConnection(&addr); -diff -urN fontforge-20170731.old/fontforge/lookups.c fontforge-20170731/fontforge/lookups.c ---- fontforge-20170731.old/fontforge/lookups.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/lookups.c 2018-09-23 14:50:31.562567627 +0530 -@@ -4746,20 +4746,26 @@ - break; - start = lpt; - if ( *start=='|' ) { -- if ( fpst->type==pst_contextpos || fpst->type==pst_contextsub ) --return( xasprintf( _("Separation marks only meaningful in contextual chaining lookups, starting at: %.20s..."), lpt )); -+ if ( fpst->type==pst_contextpos || fpst->type==pst_contextsub ){ -+ free(parsed); -+ return( xasprintf( _("Separation marks only meaningful in contextual chaining lookups, starting at: %.20s..."), lpt )); -+ } - if ( first==-1 ) - first = cnt; - else if ( last==-1 ) - last = cnt-1; -- else --return( xasprintf( _("Too many separation marks, starting at: %.20s..."), lpt )); -+ else{ -+ free(parsed); -+ return( xasprintf( _("Too many separation marks, starting at: %.20s..."), lpt )); -+ } - ++lpt; - continue; - } else if ( *start=='[' ) { - /* A coverage table */ -- if ( fpst->format!=pst_coverage && fpst->format!=pst_reversecoverage ) --return( xasprintf( _("A coverage table was found in a glyph or class based contextual lookup, starting at: %.20s..."), lpt )); -+ if ( fpst->format!=pst_coverage && fpst->format!=pst_reversecoverage ){ -+ free(parsed); -+ return( xasprintf( _("A coverage table was found in a glyph or class based contextual lookup, starting at: %.20s..."), lpt )); -+ } - ++start; - for ( lpt = start; *lpt!='\0' && *lpt!=']'; ++lpt ); - if ( *lpt!=']' ) -@@ -4788,9 +4794,10 @@ - } - free(parsed[cnt].replacements); - parsed[cnt].replacements = newr; -- } else --return( xasprintf( _("There must be as many replacement glyphs as there are match glyphs: %s => %s"), -+ } else{ -+ return( xasprintf( _("There must be as many replacement glyphs as there are match glyphs: %s => %s"), - parsed[cnt].entity, parsed[cnt].replacements)); -+ } - continue; - } - } else if ( *start!='@' && *start!='<' && !(*start=='=' && start[1]=='>') ) { -@@ -4802,14 +4809,18 @@ - /* A reverse contextual chaining */ - if ( fpst->format!=pst_reversecoverage ) - return( xasprintf( _("No replacement lists may be specified in this contextual lookup, use a nested lookup instead, starting at: %.20s..."), lpt )); -- if ( do_replacements ) --return( xasprintf( _("Only one replacement list may be specified in a reverse contextual chaining lookup, starting at: %.20s..."), lpt )); -+ if ( do_replacements ) { -+ free(parsed); -+ return( xasprintf( _("Only one replacement list may be specified in a reverse contextual chaining lookup, starting at: %.20s..."), lpt )); -+ } - do_replacements = true; - lpt += 2; - } else { - /* A lookup invocation */ -- if ( fpst->format==pst_reversecoverage ) --return( xasprintf( _("No lookups may be specified in a reverse contextual lookup (use a replacement list instead), starting at: %.20s..."), lpt )); -+ if ( fpst->format==pst_reversecoverage ){ -+ free(parsed); -+ return( xasprintf( _("No lookups may be specified in a reverse contextual lookup (use a replacement list instead), starting at: %.20s..."), lpt )); -+ } - - if ( *start=='@' ) { - for ( lpt=start+1; isspace( *lpt ); ++lpt ); -@@ -4867,8 +4878,10 @@ - ret = NULL; - - if ( !do_replacements && !anylookup ) { -- if ( fpst->format==pst_reversecoverage ) --return( copy( _("A reverse contextual chaining lookup must have a set of replacement glyphs somewhere" )) ); -+ if ( fpst->format==pst_reversecoverage ) { -+ free(parsed); -+ return( copy( _("A reverse contextual chaining lookup must have a set of replacement glyphs somewhere" )) ); -+ } - else { - *return_is_warning = true; - /* If there are no lookups then this rule matches and does nothing */ -@@ -4884,8 +4897,10 @@ - if ( first==-1 ) first = i; - } - if ( parsed[i].replacements!=NULL ) { -- if (( first!=-1 && first!=i ) || (last!=-1 && last!=i )) --return( copy( _("A reverse contextual chaining lookup can only match one coverage table directly" )) ); -+ if (( first!=-1 && first!=i ) || (last!=-1 && last!=i )){ -+ free(parsed); -+ return( copy( _("A reverse contextual chaining lookup can only match one coverage table directly" )) ); -+ } - first = last = i; - } - } -@@ -4977,11 +4992,13 @@ - free( rule->u.class.fclasses ); rule->u.class.fclasses = NULL; - rule->u.class.bcnt = rule->u.class.fcnt = rule->u.class.ncnt = 0; - if ( iu.class.bclasses[first-1-i] = j; /* Reverse the backtrack classes */ -diff -urN fontforge-20170731.old/fontforge/macbinary.c fontforge-20170731/fontforge/macbinary.c ---- fontforge-20170731.old/fontforge/macbinary.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/macbinary.c 2018-09-23 14:50:31.563567611 +0530 -@@ -299,7 +299,8 @@ - for (;;) { - if ( getc(pfbfile)!=0x80 ) { - IError("We made a pfb file, but didn't get one. Hunh?" ); --return( NULL ); -+ free(resstarts); -+ return( NULL ); - } - type = getc(pfbfile); - if ( type==3 ) { -@@ -1833,8 +1834,12 @@ - strcpy(pt-1,".fam.bin"); - #endif - } -- if ( WriteMacPSFont(tempname,sfi->sf,format,flags,sfi->map,layer)==0 ) --return( 0 ); -+ if ( WriteMacPSFont(tempname,sfi->sf,format,flags,sfi->map,layer)==0 ){ -+ free(filename); -+ free(tempname); -+ return( 0 ); -+ } -+ - free(tempname); - } - } else if ( format!=ff_none || bf==bf_sfnt_dfont ) { -@@ -1861,7 +1866,8 @@ - if ( res==NULL ) { - for ( sfsub=sfs; sfsub!=NULL; sfsub=sfsub->next ) - fclose( sfsub->tempttf ); --return( 0 ); -+ free(filename); -+ return( 0 ); - } - - if ( format==ff_ttfdfont || format==ff_otfdfont || format==ff_otfciddfont || -@@ -1982,8 +1988,9 @@ - if ( pfb==NULL ) { - LogError( _("Can't open temporary file for postscript output\n") ); - fseek(f,here,SEEK_SET ); -+ free(rsrcids); - free(offsets); --return(NULL); -+ return(NULL); - } - - putc(0x80,pfb); -@@ -2578,7 +2585,9 @@ - char *pt, *lparen; - char *find = NULL; - -- if ((pt = strrchr(filename,'/'))!=NULL ) pt = filename; -+ if ((pt = strrchr(filename,'/'))!=NULL ) -+ pt = filename; -+ - if ( (lparen = strchr(filename,'('))!=NULL && strchr(lparen,')')!=NULL ) { - find = copy(lparen+1); - pt = strchr(find,')'); -@@ -2588,6 +2597,8 @@ - if ( test->psnames[i]!=NULL && strcmp(find,test->psnames[i])==0 ) { - *style = (i&3) | ((i&~3)<<1); /* PS styles skip underline bit */ - *name = copy(test->psnames[i]); -+ free(find); -+ free(pt); - return( test ); - } - } -@@ -2670,8 +2681,10 @@ - SplineChar *sc; - - fond = PickFOND(fondlist,filename,&name,&style); -- if ( fond==NULL ) --return( NULL ); -+ if ( fond==NULL ){ -+ free(name); -+ return( NULL ); -+ } - - find_id=-1; - if ( flags&ttf_onlyonestrike ) { -@@ -2747,8 +2760,11 @@ - SplineChar *sc1, *sc2; - - fond = PickFOND(fondlist,filename,&name,&style); -- if ( fond==NULL || into==NULL ) --return( NULL ); -+ if ( fond==NULL || into==NULL ){ -+ free(name); -+ return( NULL ); -+ } -+ - for ( i=0; istylekerncnt; ++i ) - if ( fond->stylekerns[i].style==style ) - break; -@@ -2780,6 +2796,7 @@ - } - kp->off = offset; - } -+ free(name); - return( into ); - } - -@@ -2795,7 +2812,11 @@ - char **ret; - char *temp = TTFGetFontName(binary,pos,pos); - if ( temp==NULL ) --return( NULL ); -+ { -+ free(temp); -+ free(buffer); -+ return( NULL ); -+ } - ret = malloc(2*sizeof(char *)); - ret[0] = temp; - ret[1] = NULL; -diff -urN fontforge-20170731.old/fontforge/palmfonts.c fontforge-20170731/fontforge/palmfonts.c ---- fontforge-20170731.old/fontforge/palmfonts.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/palmfonts.c 2018-09-23 14:50:31.563567611 +0530 -@@ -178,6 +178,7 @@ - BCCompressBitmap(bdfc); - } - } -+ free(fontImage); - } - - static SplineFont *PalmTestFont(FILE *file,int end, char *family,const char *style) { -@@ -440,6 +441,7 @@ - putlong(file,0); - putlong(file,0); - } -+ free(pt1); - return(file); - } - -diff -urN fontforge-20170731.old/fontforge/parsepdf.c fontforge-20170731/fontforge/parsepdf.c ---- fontforge-20170731.old/fontforge/parsepdf.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/parsepdf.c 2018-09-23 14:50:31.564567596 +0530 -@@ -974,8 +974,11 @@ - while ( prev_xref!=-1 ) { - if ( fseek(pdf,prev_xref,SEEK_SET)!=0 ) return( NULL ); - pdf_skipobjectheader(pc); -- if ( !pdf_readdict(pc)) --return( NULL ); -+ if ( !pdf_readdict(pc)){ -+ free(gen); -+ free(ret); -+ return( NULL ); -+ } - if ( (pt=PSDictHasEntry(&pc->pdfdict,"Type"))==NULL || strcmp(pt,"/XRef")!=0 ) - return( NULL ); - if ( (pt=PSDictHasEntry(&pc->pdfdict,"Size"))==NULL ) -@@ -2069,6 +2072,7 @@ - pcFree(&pc); - fclose(pc.pdf); - switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale. -+ free(list); - return( NULL ); - } - -diff -urN fontforge-20170731.old/fontforge/parsettfatt.c fontforge-20170731/fontforge/parsettfatt.c ---- fontforge-20170731.old/fontforge/parsettfatt.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/parsettfatt.c 2018-09-23 14:50:31.564567596 +0530 -@@ -790,6 +790,7 @@ - if ( feof(ttf) ) { - LogError( _("Bad mark table.\n") ); - info->bad_ot = true; -+ free(classes); - return( NULL ); - } - -@@ -1386,6 +1387,7 @@ - if ( glyphs==NULL ) { - /* GT: This continues a multi-line error message, hence the leading space */ - LogError( _(" Bad contextual substitution table, ignored\n") ); -+ free(class); - free(rules); - return; - } -@@ -1543,6 +1545,7 @@ - if ( glyphs==NULL ) { - /* GT: This continues a multi-line error message, hence the leading space */ - LogError( _(" Bad contextual chaining substitution table, ignored\n") ); -+ free(class); - free(rules); - return; - } -@@ -2443,6 +2446,7 @@ - if ( pos+scripts[i].languages[j].offset>=info->g_bounds ) { - LogError(_("Attempt to read script data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(scripts); - return( NULL ); - } - fseek(ttf,pos+scripts[i].languages[j].offset,SEEK_SET); -@@ -2452,6 +2456,7 @@ - if ( feof(ttf)) { - LogError(_("End of file when reading scripts in %s table"), isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(scripts); - return( NULL ); - } - scripts[i].languages[j].features = malloc(scripts[i].languages[j].fcnt*sizeof(uint16)); -@@ -2463,6 +2468,7 @@ - if ( feof(ttf)) { - LogError(_("End of file in %s table"), isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(scripts); - return( NULL ); - } - -@@ -2502,6 +2508,7 @@ - if ( pos+features[i].offset>=info->g_bounds ) { - LogError(_("Attempt to read feature data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(features); - return( NULL ); - } - fseek(ttf,pos+features[i].offset,SEEK_SET); -@@ -2518,6 +2525,7 @@ - if ( feof(ttf) ) { - LogError(_("End of file when reading features in %s table"), isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(features); - return( NULL ); - } - features[i].lookups = malloc(features[i].lcnt*sizeof(uint16)); -@@ -2560,6 +2568,7 @@ - LogError(_("Attempt to read lookup data beyond end of %s table"), - isgpos==2? "JSTF" : isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(lookups); - return( NULL ); - } - fseek(ttf,pos+lookups[i].offset,SEEK_SET); -@@ -2585,6 +2594,7 @@ - if ( feof(ttf) ) { - LogError(_("End of file when reading lookups in %s table"), isgpos ? "GPOS" : "GSUB" ); - info->bad_ot = true; -+ free(lookups); - return( NULL ); - } - for ( j=0; jbad_ot = true; - free(soff); -+ free(loff); - return; - } - -diff -urN fontforge-20170731.old/fontforge/parsettfbmf.c fontforge-20170731/fontforge/parsettfbmf.c ---- fontforge-20170731.old/fontforge/parsettfbmf.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/parsettfbmf.c 2018-09-23 14:50:31.565567580 +0530 -@@ -91,8 +91,8 @@ - /* Only use the provided metrics if it hasn't already been set */ - if (metrics == NULL) - metrics = &big; -- if ( imageformat==8 ) -- /* pad = */ getc(ttf); -+ if ( imageformat==8 ) -+ /* pad = */ getc(ttf); - } else if ( imageformat==6 || imageformat==7 || imageformat==9 ) { - big.height = getc(ttf); - big.width = getc(ttf); -diff -urN fontforge-20170731.old/fontforge/parsettf.c fontforge-20170731/fontforge/parsettf.c ---- fontforge-20170731.old/fontforge/parsettf.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/parsettf.c 2018-09-23 14:50:31.566567564 +0530 -@@ -1972,7 +1972,8 @@ - info->bad_glyph_data = true; - LogError( _("Bad tt font: contour ends make no sense in glyph %d.\n"), - sc->orig_pos ); --return; -+ free(endpt); -+ return; - } - } - if ( path_cnt==0 ) { -diff -urN fontforge-20170731.old/fontforge/parsettfvar.c fontforge-20170731/fontforge/parsettfvar.c ---- fontforge-20170731.old/fontforge/parsettfvar.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/parsettfvar.c 2018-09-23 14:50:31.567567549 +0530 -@@ -747,6 +747,7 @@ - ti = -1; - if ( k!=info->variations->tuple_count ) - ti = k; -+ free(coords); - } - if ( ti!=-1 ) { - here = ftell(ttf); -diff -urN fontforge-20170731.old/fontforge/plugins.c fontforge-20170731/fontforge/plugins.c ---- fontforge-20170731.old/fontforge/plugins.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/plugins.c 2018-09-23 14:50:31.567567549 +0530 -@@ -35,6 +35,7 @@ - int LoadPlugin(const char *dynamic_lib_name) { - lt_dlhandle plugin; - plugin = load_plugin(dynamic_lib_name, LogError); -+ free(plugin); - return (plugin != NULL); - } - -diff -urN fontforge-20170731.old/fontforge/print.c fontforge-20170731/fontforge/print.c ---- fontforge-20170731.old/fontforge/print.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/print.c 2018-09-23 14:50:31.568567533 +0530 -@@ -2894,6 +2894,7 @@ - } - if ( pt>start && itop = io->prev; - if ( io->isstopped ) - wrapper->endedstopped = true; -- if (io->start != NULL) free(io->start); io->start = NULL; -+ if (io->start != NULL) -+ free(io->start); -+ io->start = NULL; - free(io); - io = wrapper->top; - } -@@ -353,7 +355,9 @@ - while ( io->prev!=NULL && !io->isstopped ) { - iop = io->prev; - wasloop = io->isloop; -- if (io->start != NULL) free(io->start); io->start = NULL; -+ if (io->start != NULL) -+ free(io->start); -+ io->start = NULL; - free(io); - if ( wasloop ) { - wrapper->top = iop; -@@ -377,7 +381,9 @@ - while ( io->prev!=NULL ) { - iop = io->prev; - wasstopped = io->isstopped; -- if (io->start != NULL) free(io->start); io->start = NULL; -+ if (io->start != NULL) -+ free(io->start); -+ io->start = NULL; - free(io); - if ( wasstopped ) { - wrapper->top = iop; -@@ -2292,8 +2298,14 @@ - int mx, mn; - real h, s, b; - mx = mn = r; -- if ( mx>g ) mn=g; else mx=g; -- if ( mxbl ) mn = bl; -+ if ( mx>g ) -+ mn=g; -+ else -+ mx=g; -+ if ( mxbl ) -+ mn = bl; - b = mx/255.; - s = h = 0; - if ( mx>0 ) -@@ -3364,8 +3376,10 @@ - encname = copy(tokbuf); - tok = nextpstoken(&wrapper,&dval,tokbuf,sizeof(tokbuf)); - } -- if ( tok!=pt_openarray && tok!=pt_opencurly ) -+ if ( tok!=pt_openarray && tok!=pt_opencurly ){ -+ free(encname); - return( head ); -+ } - for ( i=0; iwidthset = true; -+ free(pending_hm); -+ free(pt); - return( ret ); - } -diff -urN fontforge-20170731.old/fontforge/python.c fontforge-20170731/fontforge/python.c ---- fontforge-20170731.old/fontforge/python.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/python.c 2018-09-23 14:50:31.572567471 +0530 -@@ -1183,6 +1183,7 @@ - tuple = PyTuple_New(cnt); - for ( i=0; ispiros = SplineSet2SpiroCP(ss,&cnt); - self->spiro_cnt = cnt; -+ free(ss); - } - spirotuple = PyTuple_New(self->spiro_cnt-1); - for ( i=0; ispiro_cnt-1; ++i ) { -@@ -2893,7 +2897,10 @@ - for ( i=0; i=5 ) - smpl.linelenmax = PyFloat_AsDouble( PySequence_GetItem(args,4)); -- if ( PyErr_Occurred() ) -+ if ( PyErr_Occurred() ){ -+ free(ss); - return( NULL ); -+ } - SplinePointListSimplify(NULL,ss,&smpl); - if ( ss==NULL ) { - for ( i=0; ipt_cnt; ++i ) -@@ -3292,6 +3301,7 @@ - do_pycall(pen,"qCurveTo",tuple); - } else { - PyErr_Format(PyExc_TypeError, "Wrong number of off-curve points on a cubic contour"); -+ free(points); - return( NULL ); - } - if ( PyErr_Occurred()) -@@ -3324,6 +3334,7 @@ - if ( PyErr_Occurred()) - return( NULL ); - -+free(points); - Py_RETURN( self ); - } - -@@ -3612,6 +3623,7 @@ - ss2 = SSFromLayer((PyFF_Layer *) other); - } else { - PyErr_Format(PyExc_TypeError, "Unexpected type"); -+ free(ss); - return( -1 ); - } - ret = SSsCompare(ss,ss2,pt_err,spline_err,&badpoint); -@@ -3880,8 +3892,10 @@ - smpl.linefixup = PyFloat_AsDouble( PySequence_GetItem(args,3)); - if ( !PyErr_Occurred() && PySequence_Size(args)>=5 ) - smpl.linelenmax = PyFloat_AsDouble( PySequence_GetItem(args,4)); -- if ( PyErr_Occurred() ) -+ if ( PyErr_Occurred() ){ -+ free(ss); - return( NULL ); -+ } - ss = SplineCharSimplify(NULL,ss,&smpl); - LayerFromSS(ss,self); - SplinePointListsFree(ss); -@@ -4187,8 +4201,10 @@ - SplinePointListsFree(ss); - ss = temp; - } -- if ( !PolyCheck(ss)) -+ if ( !PolyCheck(ss)){ -+ free(ss); - return( -1 ); -+ } - si->poly = ss; - } else if ( width<=0 || minor<=0 ) { - PyErr_Format(PyExc_ValueError, "Stroke width must be positive" ); -@@ -4765,7 +4781,9 @@ - ++nexti; - if ( c->points[nexti]->on_curve ) { - PyErr_Format(PyExc_TypeError, "In cubic splines there must be exactly 2 control points between on curve points"); --return( NULL ); -+ free(ss); -+ free(sp); -+ return( NULL ); - } - if ( nexti==c->pt_cnt-1 ) - nexti = 0; -@@ -4773,7 +4791,9 @@ - ++nexti; - if ( !c->points[nexti]->on_curve ) { - PyErr_Format(PyExc_TypeError, "In cubic splines there must be exactly 2 control points between on curve points"); --return( NULL ); -+ free(sp); -+ free(ss); -+ return( NULL ); - } - } - if ( ss->last==NULL ) { -@@ -4785,6 +4805,7 @@ - } - if ( ss->last==NULL ) { - PyErr_Format(PyExc_TypeError, "Empty contour"); -+ free(ss); - return( NULL ); - } - } -@@ -6064,8 +6085,10 @@ - PyErr_Format(PyExc_TypeError, "Unexpected type"); - return( -1 ); - } -- if ( self->sc->layers[self->layer].refs!=NULL ) -+ if ( self->sc->layers[self->layer].refs!=NULL ){ -+ free(ss2); - return( SS_NoMatch | SS_RefMismatch ); -+ } - ret = SSsCompare(self->sc->layers[self->layer].splines,ss2,pt_err,spline_err,&badpoint); - SplinePointListsFree(ss2); - return(ret); -@@ -6274,8 +6297,10 @@ - uni = 0; vs = -1; fid = 0; - if ( PyInt_Check(obj)) - uni = PyInt_AsLong(obj); -- else if ( !PyArg_ParseTuple(obj,"i|ii", &uni, &vs, &fid)) -+ else if ( !PyArg_ParseTuple(obj,"i|ii", &uni, &vs, &fid)){ -+ free(head); - return( -1 ); -+ } - cur = chunkalloc(sizeof(struct altuni)); - if ( vs==0 ) vs=-1; /* convention used in charinfo */ - cur->unienc = uni; cur->vs = vs; cur->fid = fid; -@@ -6738,7 +6763,10 @@ - return( -1 ); - for ( i=0; ighost = true; -@@ -7036,8 +7064,10 @@ - - for ( i=0; isc->vert_variants = chunkalloc(sizeof(struct glyphvariants)); - self->sc->vert_variants->variants = copy(str); - } -+ free(str); - return( 0 ); - } - -@@ -7276,6 +7307,7 @@ - self->sc->horiz_variants = chunkalloc(sizeof(struct glyphvariants)); - self->sc->horiz_variants->variants = copy(str); - } -+ free(str); - return( 0 ); - } - -@@ -7761,6 +7793,7 @@ - - SCCharChangedUpdate(sc,((PyFF_Glyph *) self)->layer); - -+ free(ap); - Py_RETURN( self ); - } - -@@ -8137,6 +8170,7 @@ - } - if ( deltalen==0 ) { - PyErr_Format(PyExc_TypeError,"Glyph name strings may not be empty"); -+ free(str); - return( NULL ); - } - len += deltalen+1; -@@ -8575,6 +8609,7 @@ - old = NULL; - } else { - PyErr_Format(PyExc_KeyError, "Unexpected lookup type: %s",sub->lookup->lookup_name); -+ free(other); - return( NULL ); - } - temp.u.subs.variant = other; -@@ -13659,6 +13694,7 @@ - ext = locfilename+len-2; - if ( ext[0]!='p' || ext[1]!='k' ) { - PyErr_Format(PyExc_EnvironmentError, "No extension for bitmap font"); -+ free(ext); - return( NULL ); - } - } -@@ -13673,7 +13709,8 @@ - back = true; - } else { - PyErr_Format(PyExc_EnvironmentError, "Bad extension for bitmap font"); --return( NULL ); -+ free(ext); -+ return( NULL ); - } - if ( to_background!=-1 ) - back = to_background; -@@ -13732,8 +13769,10 @@ - free(locfilename); - return( NULL ); - } -- if ( CheckIfFontClosed(other) ) -+ if ( CheckIfFontClosed(other) ){ -+ free(locfilename); - return (NULL); -+ } - flags = FlagsFromTuple(flagstuple,compflags,"comparison flag"); - if ( flags==FLAG_UNKNOWN ) { - free(locfilename); -@@ -14316,6 +14355,8 @@ - if ( offsets!=NULL ) { - if ( cnt1*cnt2 != PySequence_Size(offsets) ) { - PyErr_Format(PyExc_ValueError, "There aren't enough kerning offsets for the number of kerning classes. Should be %d", cnt1*cnt2 ); -+ free(class1_strs); -+ free(class2_strs); - return( NULL ); - } - offs = malloc(cnt1*cnt2*sizeof(int16)); -@@ -14323,7 +14364,9 @@ - offs[i] = PyInt_AsLong(PySequence_GetItem(offsets,i)); - if ( PyErr_Occurred()) { - free(offs); --return( NULL ); -+ free(class1_strs); -+ free(class2_strs); -+ return( NULL ); - } - } - } else -@@ -14333,6 +14376,8 @@ - sub = addLookupSubtable(sf, lookup, subtable, after_str); - if ( sub==NULL ) { - free(offs); -+ free(class1_strs); -+ free(class2_strs); - return( NULL ); - } - if ( sub->lookup->lookup_type!=gpos_pair ) { -@@ -14407,6 +14452,8 @@ - cnt2 = ParseClassNames(class2s,&class2_strs); - if ( cnt1*cnt2 != PySequence_Size(offsets) ) { - PyErr_Format(PyExc_ValueError, "There aren't enough kerning offsets for the number of kerning classes. Should be %d", cnt1*cnt2 ); -+ free(class1_strs); -+ free(class2_strs); - return( NULL ); - } - offs = malloc(cnt1*cnt2*sizeof(int16)); -@@ -15266,6 +15313,7 @@ - mcnt = ParseClassNames(mclasses,&matchclasses); - if ( mcnt==-1 ) { - PyErr_Format(PyExc_TypeError, "Bad match class" ); -+ free(matchclasses); - return( NULL ); - } - if ( mclassnames!=NULL ) { -@@ -15305,6 +15353,7 @@ - new_subtable = addLookupSubtable(sf, lookup, subtable, after_str); - if ( new_subtable==NULL ) { - free(backclassnames); free(matchclasses); free(forclasses); -+ free(matchclassnames); - return( NULL ); - } - fpst = chunkalloc(sizeof(FPST)); -@@ -15495,6 +15544,7 @@ - rpl_ss = SSFromContour((PyFF_Contour *) rpl, NULL); - } else { - PyErr_Format(PyExc_TypeError, "Expected a contour or layer"); -+ free(srch_ss); - return( NULL ); - } - -@@ -15939,11 +15989,13 @@ - last = cur; - } else { - PyErr_Format(PyExc_TypeError, "Second argument must be either a font or a list of fonts"); -+ free(head); - return( NULL ); - } - } - } else { - PyErr_Format(PyExc_TypeError, "Second argument must be either a font or a list of fonts"); -+ free(head); - return( NULL ); - } - -@@ -15982,6 +16034,7 @@ - otl = SFFindLookup(fv->sf,lookup_name); - if ( otl == NULL ) { - PyErr_Format(PyExc_EnvironmentError, "No lookup named %s", lookup_name ); -+ free(locfilename); - return( NULL ); - } - } -@@ -16080,6 +16133,7 @@ - if ( sf->fv==NULL ) - EncMapFree(sf->map); - newfv = SFAdd(InterpolateFont(fv->sf,sf,fraction, fv->map->enc ),false); -+ free(sf); - return( PyFV_From_FV_I(newfv)); - } - -diff -urN fontforge-20170731.old/fontforge/savefont.c fontforge-20170731/fontforge/savefont.c ---- fontforge-20170731.old/fontforge/savefont.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/savefont.c 2018-09-23 14:50:31.573567455 +0530 -@@ -313,8 +313,10 @@ - char *buf = malloc(strlen(filename)+12), *pt; - FILE *flog; - -- if ( sf->fontlog==NULL || *sf->fontlog=='\0' ) --return( true ); -+ if ( sf->fontlog==NULL || *sf->fontlog=='\0' ) { -+ free(buf); -+ return( true ); -+ } - - strcpy(buf,filename); - pt = strrchr(buf,'/'); -diff -urN fontforge-20170731.old/fontforge/scstyles.c fontforge-20170731/fontforge/scstyles.c ---- fontforge-20170731.old/fontforge/scstyles.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/scstyles.c 2018-09-23 14:50:31.575567424 +0530 -@@ -2578,7 +2578,8 @@ - for ( j=0; jpointcnt!=s->rpointcnt ) -- MinimumDistancesFree(sc->md); sc->md = NULL; -+ MinimumDistancesFree(sc->md); -+ sc->md = NULL; - - sc_p = s->matched_sp; p_p = path->first, r_p = rpath->first; - if ( s->endpoints ) { -diff -urN fontforge-20170731.old/fontforge/sfd.c fontforge-20170731/fontforge/sfd.c ---- fontforge-20170731.old/fontforge/sfd.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/sfd.c 2018-09-23 14:50:31.576567408 +0530 -@@ -7924,10 +7924,14 @@ - { - char* sname = SFDReadUTF7Str(sfd); - if (sf->pfminfo.stylemap == -1) { -- if (strcmp(sname,"bold italic")==0) sf->pfminfo.stylemap = 0x21; -- else if (strcmp(sname,"bold")==0) sf->pfminfo.stylemap = 0x20; -- else if (strcmp(sname,"italic")==0) sf->pfminfo.stylemap = 0x01; -- else if (strcmp(sname,"regular")==0) sf->pfminfo.stylemap = 0x40; -+ if (strcmp(sname,"bold italic")==0) -+ sf->pfminfo.stylemap = 0x21; -+ else if (strcmp(sname,"bold")==0) -+ sf->pfminfo.stylemap = 0x20; -+ else if (strcmp(sname,"italic")==0) -+ sf->pfminfo.stylemap = 0x01; -+ else if (strcmp(sname,"regular")==0) -+ sf->pfminfo.stylemap = 0x40; - } - free(sname); - } -@@ -8010,7 +8014,8 @@ - { - /* Class 0 is unused */ - int temp; -- while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); ungetc(temp,sfd); -+ while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); -+ ungetc(temp,sfd); - sf->mark_class_names[i] = SFDReadUTF7Str(sfd); - getint(sfd,&temp); - sf->mark_classes[i] = malloc(temp+1); sf->mark_classes[i][temp] = '\0'; -@@ -8027,10 +8032,12 @@ - { - /* Set 0 is used */ - int temp; -- while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); ungetc(temp,sfd); -+ while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); -+ ungetc(temp,sfd); - sf->mark_set_names[i] = SFDReadUTF7Str(sfd); - getint(sfd,&temp); -- sf->mark_sets[i] = malloc(temp+1); sf->mark_sets[i][temp] = '\0'; -+ sf->mark_sets[i] = malloc(temp+1); -+ sf->mark_sets[i][temp] = '\0'; - nlgetc(sfd); /* skip space */ - fread(sf->mark_sets[i],1,temp,sfd); - } -@@ -8042,7 +8049,8 @@ - int kernclassversion = 0; - int isv = tok[0]=='V'; - int kcvoffset = (isv ? 10 : 9); //Offset to read kerning class version -- if (isdigit(tok[kcvoffset])) kernclassversion = tok[kcvoffset] - '0'; -+ if (isdigit(tok[kcvoffset])) -+ kernclassversion = tok[kcvoffset] - '0'; - int temp, classstart=1; - int old = (kernclassversion == 0); - -@@ -8088,35 +8096,51 @@ - for ( i=classstart; ifirst_cnt; ++i ) { - if (kernclassversion < 3) { - getint(sfd,&temp); -- kc->firsts[i] = malloc(temp+1); kc->firsts[i][temp] = '\0'; -+ kc->firsts[i] = malloc(temp+1); -+ kc->firsts[i][temp] = '\0'; - nlgetc(sfd); /* skip space */ - fread(kc->firsts[i],1,temp,sfd); - } else { - getint(sfd,&kc->firsts_flags[i]); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue; -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); -+ if (ch == '\n' || ch == EOF) -+ continue; - kc->firsts_names[i] = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue; -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); -+ if (ch == '\n' || ch == EOF) -+ continue; - kc->firsts[i] = SFDReadUTF7Str(sfd); - if (kc->firsts[i] == NULL) kc->firsts[i] = copy(""); // In certain places, this must be defined. -- while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); -+ ungetc(ch, sfd); - } - } - kc->seconds[0] = NULL; - for ( i=1; isecond_cnt; ++i ) { - if (kernclassversion < 3) { - getint(sfd,&temp); -- kc->seconds[i] = malloc(temp+1); kc->seconds[i][temp] = '\0'; -+ kc->seconds[i] = malloc(temp+1); -+ kc->seconds[i][temp] = '\0'; - nlgetc(sfd); /* skip space */ - fread(kc->seconds[i],1,temp,sfd); - } else { - getint(sfd,&temp); - kc->seconds_flags[i] = temp; -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue; -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); -+ if (ch == '\n' || ch == EOF) -+ continue; - kc->seconds_names[i] = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue; -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); -+ if (ch == '\n' || ch == EOF) -+ continue; - kc->seconds[i] = SFDReadUTF7Str(sfd); - if (kc->seconds[i] == NULL) kc->seconds[i] = copy(""); // In certain places, this must be defined. -- while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); -+ ungetc(ch, sfd); - } - } - for ( i=0; ifirst_cnt*kc->second_cnt; ++i ) { -@@ -8173,39 +8197,50 @@ - } - else if ( strmatch(tok,"Group:")==0 ) { - struct ff_glyphclasses *grouptmp = calloc(1, sizeof(struct ff_glyphclasses)); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - grouptmp->classname = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - grouptmp->glyphs = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); -+ ungetc(ch, sfd); - if (d->lastgroup != NULL) d->lastgroup->next = grouptmp; else sf->groups = grouptmp; - d->lastgroup = grouptmp; - } - else if ( strmatch(tok,"GroupKern:")==0 ) { - int temp = 0; - struct ff_rawoffsets *kerntmp = calloc(1, sizeof(struct ff_rawoffsets)); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - kerntmp->left = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - kerntmp->right = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - getint(sfd,&temp); - kerntmp->offset = temp; -- while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); -+ ungetc(ch, sfd); - if (d->lastgroupkern != NULL) d->lastgroupkern->next = kerntmp; else sf->groupkerns = kerntmp; - d->lastgroupkern = kerntmp; - } - else if ( strmatch(tok,"GroupVKern:")==0 ) { - int temp = 0; - struct ff_rawoffsets *kerntmp = calloc(1, sizeof(struct ff_rawoffsets)); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - kerntmp->left = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - kerntmp->right = SFDReadUTF7Str(sfd); -- while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' '); -+ ungetc(ch, sfd); - getint(sfd,&temp); - kerntmp->offset = temp; -- while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd); -+ while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); -+ ungetc(ch, sfd); - if (d->lastgroupvkern != NULL) d->lastgroupvkern->next = kerntmp; else sf->groupvkerns = kerntmp; - d->lastgroupvkern = kerntmp; - } -@@ -8710,6 +8746,7 @@ - else if ( lastnamedinstance !=NULL ) - lastnamedinstance->names = names; - pushedbacktok = true; -+ free(names); - } else if ( strmatch(tok,"MMCDV:")==0 ) { - MMSet *mm = sf->mm; - if ( mm!=NULL ) -@@ -8833,6 +8870,7 @@ - if (sf->map == NULL) sf->map = EncMapNew(sf->glyphcnt,sf->glyphcnt,&custom); - - SFDFixupUndoRefs(sf); -+ free(remap); - return( sf ); - } - -diff -urN fontforge-20170731.old/fontforge/sflayout.c fontforge-20170731/fontforge/sflayout.c ---- fontforge-20170731.old/fontforge/sflayout.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/sflayout.c 2018-09-23 14:50:31.576567408 +0530 -@@ -1285,6 +1285,7 @@ - LayoutInfo_Destroy(li); - if ( freeme!=NULL ) - arrayfree(freeme); -+ free(li); - } - - #include -@@ -1415,5 +1416,6 @@ - } - - LI_MetaChangeCleanup(li,start,end,width); -+ free(fl); - return( true ); - } -diff -urN fontforge-20170731.old/fontforge/splinefont.c fontforge-20170731/fontforge/splinefont.c ---- fontforge-20170731.old/fontforge/splinefont.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/splinefont.c 2018-09-23 14:50:31.577567393 +0530 -@@ -999,8 +999,10 @@ - unlink(spuriousname); free(spuriousname); - } else - strippedname = Unarchive(strippedname,&archivedir); -- if ( strippedname==NULL ) -- return NULL; -+ if ( strippedname==NULL ){ -+ free(archivedir); -+ return NULL; -+ } - if ( strippedname!=fname && paren!=NULL ) { - fullname = malloc(strlen(strippedname)+strlen(paren)+1); - strcpy(fullname,strippedname); -@@ -1160,7 +1162,8 @@ - checked = 'i'; - sf = SFReadIkarus(fullname); - } /* Too hard to figure out a valid mark for a mac resource file */ -- if ( file!=NULL ) fclose(file); -+ if ( file!=NULL ) -+ fclose(file); - } - - if ( sf!=NULL ) -@@ -1280,7 +1283,9 @@ - sf = NULL; - } - } -- if (fname != NULL && fname != filename) free(fname); fname = NULL; -+ if (fname != NULL && fname != filename) -+ free(fname); -+ fname = NULL; - return sf; - } - -diff -urN fontforge-20170731.old/fontforge/splineoverlap.c fontforge-20170731/fontforge/splineoverlap.c ---- fontforge-20170731.old/fontforge/splineoverlap.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/splineoverlap.c 2018-09-23 14:50:31.577567393 +0530 -@@ -494,6 +494,7 @@ - } - current_pointer = &((*current_pointer)->next); - } -+ free(tmp_pointer); - return; - } - -diff -urN fontforge-20170731.old/fontforge/splinesaveafm.c fontforge-20170731/fontforge/splinesaveafm.c ---- fontforge-20170731.old/fontforge/splinesaveafm.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/splinesaveafm.c 2018-09-23 14:55:32.054958121 +0530 -@@ -1285,8 +1285,10 @@ - ch = start[4]; start[4] = '\0'; - unicode[u++] = strtol(start,&end,16); - start[4] = ch; -- if ( *end!='\0' ) --return( -1 ); -+ if ( *end!='\0' ){ -+ free(start); -+ return( -1 ); -+ } - start += 4; - } - return( u ); -@@ -3424,6 +3426,7 @@ - free( italicindex ); - } else - free( lkarray ); -+ free(kerns); - return( !ferror(tfm)); - } - -diff -urN fontforge-20170731.old/fontforge/splinestroke.c fontforge-20170731/fontforge/splinestroke.c ---- fontforge-20170731.old/fontforge/splinestroke.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/splinestroke.c 2018-09-23 14:50:31.578567377 +0530 -@@ -3847,6 +3847,7 @@ - c.resolution = c.radius/3; - if (c.resolution == 0) { - ff_post_notice(_("Invalid stroke parameters"), _("Stroke resolution is zero")); -+ free(first); - return SplinePointListCopy(ss); - } - cur = SplineSets_Stroke(ss,&c,order2); -diff -urN fontforge-20170731.old/fontforge/splineutil.c fontforge-20170731/fontforge/splineutil.c ---- fontforge-20170731.old/fontforge/splineutil.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/splineutil.c 2018-09-23 14:50:31.579567361 +0530 -@@ -224,7 +224,8 @@ - next = spline->to->next; // Cache the location of the next spline. - SplinePointFree(spline->to); // Free the destination point. - SplineFree(spline); // Free the spline. -- if ( first==NULL ) first = spline; // We want to avoid repeating the circuit. -+ if ( first==NULL ) -+ first = spline; // We want to avoid repeating the circuit. - } - // If the path is open or has no splines, free the starting point. - if ( spl->last!=spl->first || nonext ) -@@ -262,7 +263,8 @@ - next = spline->to->next; - SplinePointMDFree(sc,spline->to); - SplineFree(spline); -- if ( first==NULL ) first = spline; -+ if ( first==NULL ) -+ first = spline; - } - if ( freefirst ) - SplinePointMDFree(sc,spl->first); -@@ -1404,7 +1406,8 @@ - last = cur; - i = j; - } --return( head ); -+ free(list); -+ return( head ); - } - - SplinePointList *SplinePointListCopy(const SplinePointList *base) { -diff -urN fontforge-20170731.old/fontforge/strlist.c fontforge-20170731/fontforge/strlist.c ---- fontforge-20170731.old/fontforge/strlist.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/strlist.c 2018-09-23 14:50:31.579567361 +0530 -@@ -34,6 +34,7 @@ - list->next = NULL; - list->str = str2; - } -+ free(str2); - return list; - } - -diff -urN fontforge-20170731.old/fontforge/svg.c fontforge-20170731/fontforge/svg.c ---- fontforge-20170731.old/fontforge/svg.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/svg.c 2018-09-23 14:50:31.580567346 +0530 -@@ -2634,8 +2634,11 @@ - if ( name!=NULL ) { - int hide = xmlStrcmp(name,(xmlChar *) "none")==0; - xmlFree(name); -- if ( hide ) --return( NULL ); -+ if ( hide ){ -+ free(fill_colour_source); -+ free(stroke_colour_source); -+ return( NULL ); -+ } - } - name = xmlGetProp(svg,(xmlChar *) "visibility"); - if ( name!=NULL ) { -@@ -2772,7 +2775,9 @@ - - if ( !st.isvisible ) { - SvgStateFree(&st); --return( NULL ); -+ free(fill_colour_source); -+ free(stroke_colour_source); -+ return( NULL ); - } - - /* basic shapes */ -@@ -2798,8 +2803,11 @@ - return( eret ); - } else - return( NULL ); -- if ( head==NULL ) --return( NULL ); -+ if ( head==NULL ){ -+ free(fill_colour_source); -+ free(stroke_colour_source); -+ return( NULL ); -+ } - - SPLCategorizePoints(head); - -@@ -3056,6 +3064,7 @@ - } - free(u); - } -+ free(chars); - } - - static char *SVGGetNames(SplineFont *sf,xmlChar *g,xmlChar *utf8,SplineChar **sc) { -diff -urN fontforge-20170731.old/fontforge/tottfaat.c fontforge-20170731/fontforge/tottfaat.c ---- fontforge-20170731.old/fontforge/tottfaat.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/tottfaat.c 2018-09-23 14:50:31.580567346 +0530 -@@ -1483,6 +1483,7 @@ - } - free(scripts); - } -+ free(sm); - return( features ); - } - -diff -urN fontforge-20170731.old/fontforge/tottf.c fontforge-20170731/fontforge/tottf.c ---- fontforge-20170731.old/fontforge/tottf.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/tottf.c 2018-09-23 14:50:31.581567330 +0530 -@@ -4394,8 +4394,10 @@ - (subheadcnt-i)*sizeof(struct subhead) + sizeof(uint16); - - sub = tmpfile(); -- if ( sub==NULL ) --return( NULL ); -+ if ( sub==NULL ){ -+ free(glyphs); -+ return( NULL ); -+ } - - putshort(sub,2); /* 8/16 format */ - putshort(sub,0); /* Subtable length, we'll come back and fix this */ -diff -urN fontforge-20170731.old/fontforge/tottfgpos.c fontforge-20170731/fontforge/tottfgpos.c ---- fontforge-20170731.old/fontforge/tottfgpos.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/tottfgpos.c 2018-09-23 14:54:53.300546119 +0530 -@@ -452,8 +452,10 @@ - ++cnt; - } - } -- if ( cnt==0 ) --return( NULL ); -+ if ( cnt==0 ){ -+ free(array); -+ return( NULL ); -+ } - if ( j==1 ) - break; - array = malloc((cnt+1)*sizeof(SplineChar *)); -@@ -583,13 +585,14 @@ - // And we null-terminate. - glyphs[i] = NULL; - } -- for ( i=0; ittf_glyph==glyphs[i+1]->ttf_glyph) { - // fprintf(stderr, "Duplicate glyph.\n"); - memmove(glyphs+i, glyphs+i+1, (cnt-i)*sizeof(SplineChar *)); - --cnt; - } -- glyphs[cnt] = NULL; -+ } -+ glyphs[cnt] = NULL; - return( glyphs ); - } - -@@ -3476,8 +3479,10 @@ - glyphs = malloc((lcnt+1)*sizeof(SplineChar *)); - glyphs[lcnt] = NULL; - } -- if ( !needsclass && lcnt==0 && sf->mark_class_cnt==0 && sf->mark_set_cnt==0 ) --return; /* No anchor positioning, no ligature carets */ -+ if ( !needsclass && lcnt==0 && sf->mark_class_cnt==0 && sf->mark_set_cnt==0 ){ -+ free(glyphs); -+ return; /* No anchor positioning, no ligature carets */ -+ } - - at->gdef = tmpfile(); - if ( sf->mark_set_cnt==0 ) { -diff -urN fontforge-20170731.old/fontforge/ttfinstrs.c fontforge-20170731/fontforge/ttfinstrs.c ---- fontforge-20170731.old/fontforge/ttfinstrs.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/ttfinstrs.c 2018-09-23 14:50:31.582567314 +0530 -@@ -309,7 +309,8 @@ - val = strtol(pt,&end,0); - if ( val>32767 || val<-32768 ) { - IVError(iv,_("A value must be between [-32768,32767]"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - - pt = end; -@@ -317,14 +318,16 @@ - if ( *pt == '@' ) { /* a delta control byte */ - if ( val>8 || val<-8 || val==0 ) { - IVError(iv,_("A value must be between [-8,-1] or [1,8]"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - - pt++; - - if ( !isdigit( *pt ) ) { - IVError(iv,_("Number expected"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - - temp = val; -@@ -332,7 +335,8 @@ - - if ( val>15 || val<0 ) { - IVError(iv,_("A value must be between [0,15]"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - - val *= 16; -@@ -348,14 +352,16 @@ - while ( *pt==' ' || *pt=='\t' ) ++pt; - if ( *pt!='(' ) { - IVError(iv,_("Missing left parenthesis in command to get a cvt index"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - temp = strtol(pt+1,&end,0); - pt = end; - while ( *pt==' ' || *pt=='\t' ) ++pt; - if ( *pt!=')' ) { - IVError(iv,_("Missing right paren in command to get a cvt index"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - numberstack[npos++] = TTF__getcvtval(sf,temp); - ++pt; -@@ -396,7 +402,8 @@ - } - if ( nread=32 ) { - IVError(iv,_("Bracketted value is too large"),pt-text); --return( NULL ); -+ free(instrs); -+ return( NULL ); - } - i += val; - } -diff -urN fontforge-20170731.old/fontforge/ttfspecial.c fontforge-20170731/fontforge/ttfspecial.c ---- fontforge-20170731.old/fontforge/ttfspecial.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/ttfspecial.c 2018-09-23 14:54:21.159033774 +0530 -@@ -1356,6 +1356,7 @@ - } - } - free(contours); -+ free(cur); - } - - static void pfed_readguidelines(FILE *ttf,struct ttfinfo *info,uint32 base) { -diff -urN fontforge-20170731.old/fontforge/ufo.c fontforge-20170731/fontforge/ufo.c ---- fontforge-20170731.old/fontforge/ufo.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/ufo.c 2018-09-23 14:50:31.583567299 +0530 -@@ -2513,7 +2513,18 @@ - } - lastref = r; - } -- if (xs) free(xs); if (ys) free(ys); if (xys) free(xys); if (yxs) free(yxs); if (xo) free(xo); if (yo) free(yo); -+ if (xs) -+ free(xs); -+ if (ys) -+ free(ys); -+ if (xys) -+ free(xys); -+ if (yxs) -+ free(yxs); -+ if (xo) -+ free(xo); -+ if (yo) -+ free(yo); - } else if ( xmlStrcmp(contour->name,(const xmlChar *) "contour")==0 ) { - xmlNodePtr npoints; - -@@ -4065,12 +4076,12 @@ - strncmp(sf->names->names[ttf_version],"Version ",8)==0 ) - sf->version = copy(sf->names->names[ttf_version]+8); - -- char * layercontentsname = buildname(basedir,"layercontents.plist"); -- char ** layernames = NULL; -- if (layercontentsname == NULL) { -+ char * layercontentsname = buildname(basedir,"layercontents.plist"); -+ char ** layernames = NULL; -+ if (layercontentsname == NULL) { - switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale. - return( NULL ); -- } else if ( GFileExists(layercontentsname)) { -+ } else if ( GFileExists(layercontentsname)) { - xmlDocPtr layercontentsdoc = NULL; - xmlNodePtr layercontentsplist = NULL; - xmlNodePtr layercontentsdict = NULL; -diff -urN fontforge-20170731.old/fontforgeexe/alignment.c fontforge-20170731/fontforgeexe/alignment.c ---- fontforge-20170731.old/fontforgeexe/alignment.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/alignment.c 2018-09-23 14:50:31.583567299 +0530 -@@ -126,8 +126,10 @@ - } - - /* we need at least three regions to space things out */ -- if ( rcnt<3 ) -+ if ( rcnt<3 ){ -+ free(regions); - return; -+ } - - /* Now should I allow equal spaces between regions, or spaces between */ - /* region mid-points? I think spaces between regions */ -diff -urN fontforge-20170731.old/fontforgeexe/charinfo.c fontforge-20170731/fontforgeexe/charinfo.c ---- fontforge-20170731.old/fontforgeexe/charinfo.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/charinfo.c 2018-09-23 14:50:31.584567283 +0530 -@@ -3008,6 +3008,7 @@ - for ( j=0; ju.mouse = event->u.mouse; -- if ( dx<0 ) dx = -dx; if ( dy<0 ) dy = -dy; -+ if ( dx<0 ) -+ dx = -dx; -+ if ( dy<0 ) -+ dy = -dy; - if ( dy >= 2*dx ) { - cv->p.x = fake->u.mouse.x = basex; - cv->p.cx = basetruex ; -@@ -4726,6 +4729,7 @@ - { - GGadgetSetTitle( cv->charselector, p ); - } -+ free(srctxt); - } - - -@@ -5328,7 +5332,10 @@ - int sign = dx*dy<0?-1:1; - double aspect = 1.0; - -- if ( dx<0 ) dx = -dx; if ( dy<0 ) dy = -dy; -+ if ( dx<0 ) -+ dx = -dx; -+ if ( dy<0 ) -+ dy = -dy; - if ( cv->p.img!=NULL && cv->p.img->bb.minx!=cv->p.img->bb.maxx ) - aspect = (cv->p.img->bb.maxy - cv->p.img->bb.miny) / (cv->p.img->bb.maxx - cv->p.img->bb.minx); - else if ( cv->p.ref!=NULL && cv->p.ref->bb.minx!=cv->p.ref->bb.maxx ) -@@ -7487,8 +7494,10 @@ - e.u.control.subtype = et_textchanged; - e.u.control.u.tf_changed.from_pulldown = 0; - CV_OnCharSelectorTextChanged( cv->charselector, &e ); -+ free(txt); - return; - } -+ free(txt); - } - - if ( mid == MID_Next ) { -@@ -12810,6 +12819,7 @@ - } - } - } -+ free(wll); - } - free(txt); - -diff -urN fontforge-20170731.old/fontforgeexe/contextchain.c fontforge-20170731/fontforgeexe/contextchain.c ---- fontforge-20170731.old/fontforgeexe/contextchain.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/contextchain.c 2018-09-23 14:50:31.586567252 +0530 -@@ -641,6 +641,7 @@ - (&r->u.class.nclasses)[which] = malloc(any*sizeof(uint16)); - } - } -+ free(pt); - return( true ); - } - -diff -urN fontforge-20170731.old/fontforgeexe/cvgetinfo.c fontforge-20170731/fontforgeexe/cvgetinfo.c ---- fontforge-20170731.old/fontforgeexe/cvgetinfo.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/cvgetinfo.c 2018-09-23 14:50:31.586567252 +0530 -@@ -1059,6 +1059,7 @@ - ti = AnchorClassesLList(sf),false); - for ( j=0; ti[j]->text!=NULL && ti[j]->userdata!=ac; ++j ) - GGadgetSelectOneListItem(GWidgetGetControl(ci->gw,CID_NameList),j); -+ free(name); - return( true ); - } - -@@ -3903,8 +3904,11 @@ - } - ++k; - } while ( k<_sf->subfontcnt ); -- if ( tot==0 ) -+ if ( tot==0 ){ -+ free(deps); -+ free(depsc); - return; -+ } - if ( j==0 ) { - deps = calloc(tot+1,sizeof(char *)); - depsc = malloc(tot*sizeof(SplineChar *)); -diff -urN fontforge-20170731.old/fontforgeexe/cvimportdlg.c fontforge-20170731/fontforgeexe/cvimportdlg.c ---- fontforge-20170731.old/fontforgeexe/cvimportdlg.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/cvimportdlg.c 2018-09-23 14:50:31.587567236 +0530 -@@ -427,8 +427,10 @@ - GGadget *tf; - - GFileChooserGetChildren(d->gfc,NULL,NULL,&tf); -- if ( *_GGadgetGetTitle(tf)=='\0' ) -+ if ( *_GGadgetGetTitle(tf)=='\0' ){ -+ free(temp); - return( true ); -+ } - GDrawSetCursor(GGadgetGetWindow(g),ct_watch); - if ( d->fv!=NULL ) - flast_format = pos; -diff -urN fontforge-20170731.old/fontforgeexe/cvpalettes.c fontforge-20170731/fontforgeexe/cvpalettes.c ---- fontforge-20170731.old/fontforgeexe/cvpalettes.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/cvpalettes.c 2018-09-23 14:50:31.587567236 +0530 -@@ -2432,6 +2432,7 @@ - - layerinfo.rename_active = 0; - CVInfoDrawText(cv,cv->gw); -+ free(str); - } - } - -diff -urN fontforge-20170731.old/fontforgeexe/displayfonts.c fontforge-20170731/fontforgeexe/displayfonts.c ---- fontforge-20170731.old/fontforgeexe/displayfonts.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/displayfonts.c 2018-09-23 14:50:31.588567221 +0530 -@@ -138,6 +138,7 @@ - float pw,ph, scale; - if ( sscanf(cret,"%gx%g",&pw,&ph)!=2 ) { - IError("Bad Pagesize must be a known name or x\nWhere is one of pt (points), mm, cm, in" ); -+ free(cret); - return( true ); - } - pt = cret+strlen(cret)-1; -@@ -152,6 +153,7 @@ - scale = 1; - else { - IError("Bad Pagesize units are unknown\nMust be one of pt (points), mm, cm, in" ); -+ free(pt); - return( true ); - } - pgwidth = pw*scale; pgheight = ph*scale; -@@ -1431,6 +1433,7 @@ - feats[cnt] = 0; - /* These will be ordered because the list widget will do that */ - SFTFSetFeatures(GWidgetGetControl(di->gw,CID_SampleText),-1,-1,feats); -+ free(feats); - } - return( true ); - } -diff -urN fontforge-20170731.old/fontforgeexe/fontinfo.c fontforge-20170731/fontforgeexe/fontinfo.c ---- fontforge-20170731.old/fontforgeexe/fontinfo.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/fontinfo.c 2018-09-23 14:50:31.589567205 +0530 -@@ -3752,6 +3752,7 @@ - } - } - } -+ free(changed); - } - - static void StoreTTFNames(struct gfi_data *d) { -diff -urN fontforge-20170731.old/fontforgeexe/fontview.c fontforge-20170731/fontforgeexe/fontview.c ---- fontforge-20170731.old/fontforgeexe/fontview.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/fontview.c 2018-09-23 14:50:31.590567190 +0530 -@@ -582,6 +582,7 @@ - GGadgetSetTitle8(fc,newname); - save_to_dir = *_s2d = s2d; - SavePrefs(true); -+ free(oldname); - } - return( true ); - } -@@ -3741,12 +3742,15 @@ - free(filename); - if ( new==NULL ) - return; -- if ( new->fv == &fv->b ) /* Already part of us */ -+ if ( new->fv == &fv->b ) { /* Already part of us */ -+ free(new); - return; -+ } - if ( new->fv != NULL ) { - if ( ((FontView *) (new->fv))->gw!=NULL ) - GDrawRaise( ((FontView *) (new->fv))->gw); - ff_post_error(_("Please close font"),_("Please close %s before inserting it into a CID font"),new->origname); -+ free(new); - return; - } - EncMapFree(new->map); -@@ -4978,9 +4982,11 @@ - nl = NameListByName(namelists[ret]); - if ( nl==NULL ) { - IError("Couldn't find namelist"); -+ free(namelists); - return; - } else if ( nl!=NULL && nl->uses_unicode && !allow_utf8_glyphnames) { - ff_post_error(_("Namelist contains non-ASCII names"),_("Glyph names should be limited to characters in the ASCII character set, but there are names in this namelist which use characters outside that range.")); -+ free(namelists); - return; - } - SFRenameGlyphsToNamelist(fv->b.sf,nl); -@@ -6699,7 +6705,9 @@ - msg = xasprintf ( "%u 0x%x U+%04X \"%.25s\" %.100s", - localenc, localenc, upos, - (sc->name == NULL) ? "" : sc->name, uniname ); -- if ( uniname != NULL ) free( uniname ); uniname = NULL; -+ if ( uniname != NULL ) -+ free( uniname ); -+ uniname = NULL; - - /* annotation */ - char *uniannot = unicode_annot( upos ); -@@ -8129,6 +8137,7 @@ - free(repr); - *rpt++ = ' '; - } -+ free(repr); - } - } - if ( k==0 ) -diff -urN fontforge-20170731.old/fontforgeexe/fvfontsdlg.c fontforge-20170731/fontforgeexe/fvfontsdlg.c ---- fontforge-20170731.old/fontforgeexe/fvfontsdlg.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/fvfontsdlg.c 2018-09-23 14:50:31.590567190 +0530 -@@ -73,6 +73,7 @@ - file = fpt+2; - } while ( fpt!=NULL ); - free(filename); -+ free(sf); - } - - GTextInfo *BuildFontList(FontView *except) { -@@ -285,6 +286,7 @@ - if ( sf==NULL ) - return; - FontViewCreate(InterpolateFont(fv->b.sf,sf,amount,fv->b.map->enc),false); -+ free(sf); - } - - #define CID_Amount 1000 -diff -urN fontforge-20170731.old/fontforgeexe/histograms.c fontforge-20170731/fontforgeexe/histograms.c ---- fontforge-20170731.old/fontforgeexe/histograms.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/histograms.c 2018-09-23 14:50:31.590567190 +0530 -@@ -573,8 +573,11 @@ - ret2 = GGadgetGetTitle(GWidgetGetControl(hist->gw,CID_SecondaryVal)); - hist->done = true; - if ( (*ret1=='\0' || uc_strcmp(ret1,"[]")==0 ) && -- (*ret2=='\0' || uc_strcmp(ret2,"[]")==0 ) && p==NULL ) -+ (*ret2=='\0' || uc_strcmp(ret2,"[]")==0 ) && p==NULL ){ -+ free(ret1); -+ free(ret2); - return; -+ } - if ( p==NULL ) { - hist->sf->private = p = calloc(1,sizeof(struct psdict)); - p->cnt = 10; -@@ -583,6 +586,8 @@ - } - PSDictChangeEntry(p,primary,temp=cu_copy(ret1)); free(temp); - PSDictChangeEntry(p,secondary,temp=cu_copy(ret2)); free(temp); -+ free(ret1); -+ free(ret2); - } - - static int leftside_e_h(GWindow gw, GEvent *event) { -diff -urN fontforge-20170731.old/fontforgeexe/kernclass.c fontforge-20170731/fontforgeexe/kernclass.c ---- fontforge-20170731.old/fontforgeexe/kernclass.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/kernclass.c 2018-09-23 14:50:31.591567174 +0530 -@@ -1345,6 +1345,7 @@ - KCD_VShow(kcd,i); - else - KCD_HShow(kcd,i); -+ free(name); - return( true ); - } - if ( *pt=='(' ) { -@@ -1358,7 +1359,9 @@ - /* Otherwise deselect everything */ - if ( nlen!=0 ) - GMatrixEditActivateRowCol(list,-1,-1); -+ free(name); - } -+ - return( true ); - } - -@@ -2235,6 +2238,7 @@ - - GDrawRequestExpose(kcd->subw,NULL,false); - -+ free(other); - return( new ); - } - -diff -urN fontforge-20170731.old/fontforgeexe/lookupui.c fontforge-20170731/fontforgeexe/lookupui.c ---- fontforge-20170731.old/fontforgeexe/lookupui.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/lookupui.c 2018-09-23 14:54:04.668283976 +0530 -@@ -2779,16 +2779,23 @@ - char *suffix = GGadgetGetTitle8(GWidgetGetControl(pstkd->gw,CID_Suffix)); - SplineChar *alt, *sc; - -- if ( col!=0 || !wasnew || psts[row*cols+0].u.md_str==NULL ) -+ if ( col!=0 || !wasnew || psts[row*cols+0].u.md_str==NULL ){ -+ free(suffix); - return; -- if ( *suffix=='\0' || ( suffix[0]=='.' && suffix[1]=='\0' )) -+ } -+ if ( *suffix=='\0' || ( suffix[0]=='.' && suffix[1]=='\0' )){ -+ free(suffix); - return; -+ } - sc = SFGetChar(pstkd->sf,-1,psts[row*cols+0].u.md_str); -- if ( sc==NULL ) -+ if ( sc==NULL ){ -+ free(suffix); - return; -+ } - alt = SuffixCheck(sc,suffix); - if ( alt!=NULL ) - psts[row*cols+1].u.md_str = copy(alt->name); -+ free(suffix); - } - - static void PSTKD_FinishBoundsEdit(GGadget *g, int row, int col, int wasnew) { -@@ -3403,8 +3410,8 @@ - if ( *suffix!='\0' && ( suffix[0]!='.' || suffix[1]!='\0' )) { - free(pstkd->sub->suffix); - pstkd->sub->suffix = ( *suffix=='.' ) ? copy(suffix+1): copy(suffix); -- free(suffix); - } -+ free(suffix); - } - - static int PSTKD_PopulateWithSuffix(GGadget *g, GEvent *e) { -@@ -3953,6 +3960,8 @@ - error2SFDTrimUndoOldToNew: fclose(nf); - error1SFDTrimUndoOldToNew: fclose(retf); - error0SFDTrimUndoOldToNew: -+ free(nglyph); -+ free(oglyph); - return 0; - } - -@@ -4229,9 +4238,11 @@ - dlist_pushfront( (struct dlistnode **)&sf->undoes, (struct dlistnode *)undo ); - } - // printf("we now have %d splinefont level undoes\n", dlist_size((struct dlistnode **)&sf->undoes)); -+ free(str); - } - - pstkd->done = true; -+ free(oldsfd); - } - return( true ); - } -@@ -6069,6 +6080,7 @@ - while ( (lang = StrNextLang(&pt))!=0 ) { - if ( lang==0xffffffff ) { - ff_post_error(_("Invalid language"), _("Please specify a comma separated list of 4 letter opentype language tags")); -+ free(langs); - return( true ); - } - } -diff -urN fontforge-20170731.old/fontforgeexe/macencui.c fontforge-20170731/fontforgeexe/macencui.c ---- fontforge-20170731.old/fontforgeexe/macencui.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/macencui.c 2018-09-23 14:50:31.592567158 +0530 -@@ -425,6 +425,7 @@ - nd->done = true; - } - } -+ free(temp); - return( true ); - } - -diff -urN fontforge-20170731.old/fontforgeexe/metricsview.c fontforge-20170731/fontforgeexe/metricsview.c ---- fontforge-20170731.old/fontforgeexe/metricsview.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/metricsview.c 2018-09-23 14:50:31.592567158 +0530 -@@ -1970,8 +1970,11 @@ - if ( *pt!=mv->chars[i]->unicodeenc && - !MVOddMatch(mv,*pt,mv->chars[i])) - break; -- if ( i==mv->clen && *pt=='\0' ) --return; /* Nothing changed */ -+ if ( i==mv->clen && *pt=='\0' ){ -+ free(pt); -+return; -+ } -+ /* Nothing changed */ - for ( ept=ret+u_strlen(ret)-1, ei=mv->clen-1; ; --ei, --ept ) - if ( ei<0 || eptchars[ei]->unicodeenc && - !MVOddMatch(mv,*ept,mv->chars[ei]))) { -@@ -2046,6 +2049,7 @@ - - selectUserChosenWordListGlyphs( mv, wll ); - GDrawRequestExpose(mv->v,NULL,false); -+ free(pt); - } - - GTextInfo mv_text_init[] = { -diff -urN fontforge-20170731.old/fontforgeexe/mmdlg.c fontforge-20170731/fontforgeexe/mmdlg.c ---- fontforge-20170731.old/fontforgeexe/mmdlg.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/mmdlg.c 2018-09-23 14:50:31.593567143 +0530 -@@ -1980,6 +1980,7 @@ - enc = default_encoding; - FVReencode((FontViewBase *) fv,enc); - mmw->done = true; -+ free(setto); - } - - static void MMW_DoNext(MMW *mmw) { -@@ -2374,17 +2375,19 @@ - if ( ti!=NULL && ti->userdata == (void *) -1 ) { - temp = GetPostScriptFontName(NULL,false); - if ( temp==NULL ) --return(true); -+ return(true); - sf = LoadSplineFont(temp,0); - free(temp); temp = NULL; - if ( sf==NULL ) --return(true); -+ return(true); - if ( sf->cidmaster!=NULL || sf->subfonts!=0 ) { - ff_post_error(_("Bad Multiple Master Font"),_("CID keyed fonts may not be a master design of a multiple master font")); --return(true); -+ free(sf); -+ return(true); - } else if ( sf->mm!=NULL ) { - ff_post_error(_("Bad Multiple Master Font"),_("CID keyed fonts may not be a master design of a multiple master font")); --return(true); -+ free(sf); -+ return(true); - } - if ( sf->fv==NULL ) { - if ( mmw->lcnt>=mmw->lmax ) { -@@ -2406,6 +2409,7 @@ - GGadgetSetTitle(g,ut = uc_copy(sf->fontname)); - free(ut); - } -+ free(sf); - } - return( true ); - } -diff -urN fontforge-20170731.old/fontforgeexe/prefs.c fontforge-20170731/fontforgeexe/prefs.c ---- fontforge-20170731.old/fontforgeexe/prefs.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/prefs.c 2018-09-23 14:50:31.593567143 +0530 -@@ -2380,6 +2380,7 @@ - hvarray[si++] = &pgcd[gc-1]; - hvarray[si++] = GCD_ColSpan; hvarray[si++] = GCD_ColSpan; - y += 28; -+ free(nlnames); - } break; - case pr_string: case pr_file: - if ( pl->set==SetAutoTraceArgs || ((char **) pl->val)==&mf_args ) -@@ -2955,6 +2956,7 @@ - hvarray[si++] = &pgcd[gc-1]; - hvarray[si++] = GCD_ColSpan; hvarray[si++] = GCD_ColSpan; - y += 28; -+ free(nlnames); - } break; - case pr_string: case pr_file: - if ( pl->set==SetAutoTraceArgs || ((char **) pl->val)==&mf_args ) -diff -urN fontforge-20170731.old/fontforgeexe/savefontdlg.c fontforge-20170731/fontforgeexe/savefontdlg.c ---- fontforge-20170731.old/fontforgeexe/savefontdlg.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/savefontdlg.c 2018-09-23 14:50:31.594567127 +0530 -@@ -1426,8 +1426,10 @@ - oldbitmapstate = GGadgetGetFirstListSelectedItem(d->bmptype); - if ( oldbitmapstate!=bf_none ) - sizes = ParseBitmapSizes(d->bmpsizes,_("Pixel List"),&err); -- if ( err ) -+ if ( err ){ -+ free(temp); - return; -+ } - if ( oldbitmapstate==bf_nfntmacbin && oldformatstate!=ff_pfbmacbin && !nfnt_warned ) { - nfnt_warned = true; - ff_post_notice(_("The 'NFNT' bitmap format is obsolete"),_("The 'NFNT' bitmap format is not used under OS/X (though you still need to create a (useless) bitmap font if you are saving a type1 PostScript resource)")); -@@ -1484,7 +1486,9 @@ - d->done = true; - d->ret = false; - SFValidationWindow(d->sf,layer,oldformatstate); --return; -+ free(sizes); -+ free(temp); -+ return; - } - /* Ok... they want to proceed */ - } -@@ -1581,6 +1585,7 @@ - free(temp); - d->done = !err; - d->ret = !err; -+ free(cur); - } - - static void GFD_doesnt(GIOControl *gio) { -@@ -2109,6 +2114,7 @@ - } - if ( MacStyleCode(sf,NULL)!=0 || familycnt<=1 || sf->multilayer ) { - ff_post_error(_("Bad Mac Family"),_("To generate a Mac family file, the current font must have plain (Normal, Regular, etc.) style, and there must be other open fonts with the same family name.")); -+ free(familysfs); - return( 0 ); - } else if ( dup ) { - MacStyleCode(dup,&psstyle); -diff -urN fontforge-20170731.old/fontforgeexe/scstylesui.c fontforge-20170731/fontforgeexe/scstylesui.c ---- fontforge-20170731.old/fontforgeexe/scstylesui.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/scstylesui.c 2018-09-23 14:50:31.594567127 +0530 -@@ -2323,6 +2323,7 @@ - FVTrans((FontViewBase *) fv,sc,transform,NULL,fvt_dontmovewidth); - } - } -+ free(ret); - } - - -diff -urN fontforge-20170731.old/fontforgeexe/sftextfield.c fontforge-20170731/fontforgeexe/sftextfield.c ---- fontforge-20170731.old/fontforgeexe/sftextfield.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/sftextfield.c 2018-09-23 14:50:31.594567127 +0530 -@@ -702,8 +702,10 @@ - } - for ( cnt=0; scriptlangs[cnt]!=NULL; ++cnt ); - i = ff_choose(_("Text from script"),(const char **) scriptlangs,cnt,0,_("Insert random text in the specified script")); -- if ( i==-1 ) -+ if ( i==-1) { -+ free(freq); - return; -+ } - pos = strlen(scriptlangs[i])-10; - script = (scriptlangs[i][pos+0]<<24) | - (scriptlangs[i][pos+1]<<16) | -@@ -2303,6 +2305,7 @@ - } - - SFTFMetaChangeCleanup(st,start,end); -+ free(fl); - return( true ); - } - -@@ -2323,6 +2326,7 @@ - } - - SFTFMetaChangeCleanup(st,start,end); -+ free(fl); - return( true ); - } - -@@ -2345,6 +2349,7 @@ - } - - SFTFMetaChangeCleanup(st,start,end); -+ free(fl); - return( true ); - } - -@@ -2365,6 +2370,7 @@ - } - - SFTFMetaChangeCleanup(st,start,end); -+ free(fl); - return( true ); - } - -@@ -2385,6 +2391,7 @@ - } - - SFTFMetaChangeCleanup(st,start,end); -+ free(fl); - return( true ); - } - -@@ -2401,6 +2408,7 @@ - } - - SFTFMetaChangeCleanup(st,start,end); -+ free(fl); - return( true ); - } - -diff -urN fontforge-20170731.old/fontforgeexe/statemachine.c fontforge-20170731/fontforgeexe/statemachine.c ---- fontforge-20170731.old/fontforgeexe/statemachine.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/statemachine.c 2018-09-23 14:50:31.595567112 +0530 -@@ -438,6 +438,7 @@ - - /* Show changes in main window */ - GDrawRequestExpose(smd->gw,NULL,false); -+ free(ret8); - return( true ); - } - -diff -urN fontforge-20170731.old/fontforgeexe/wordlistparser.c fontforge-20170731/fontforgeexe/wordlistparser.c ---- fontforge-20170731.old/fontforgeexe/wordlistparser.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforgeexe/wordlistparser.c 2018-09-23 14:50:31.595567112 +0530 -@@ -799,7 +799,8 @@ - if( element_selected ) - uc_strcat( ret, "]" ); - } -- -+ -+ free(wll); - return ret; - } - -@@ -841,6 +842,7 @@ - { - // we can't go back manually! - u_strcpy( ret, original_data ); -+ free(wll); - return ret; - } - } -@@ -862,6 +864,7 @@ - uc_strcat( ret, "]" ); - } - -+ free(wll); - return ret; - } - -diff -urN fontforge-20170731.old/gdraw/gimageclut.c fontforge-20170731/gdraw/gimageclut.c ---- fontforge-20170731.old/gdraw/gimageclut.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gdraw/gimageclut.c 2018-09-23 14:50:31.595567112 +0530 -@@ -460,9 +460,10 @@ - - if ( clut==NULL ) - clut = malloc(sizeof(GClut)); -- if ( clutmax<2 || clut==NULL ) -+ if ( clutmax<2 || clut==NULL ){ -+ free(clut); - return( 0 ); -- -+ } - clut->clut_len = 0; clut->is_grey = false; - if ( clutmax>256 ) clutmax = 256; - -@@ -555,14 +556,24 @@ - if ( test->next==NULL ) - return( (GCol *) test ); - -- if (( best = (r-test->red))<0 ) best = -best; -- if (( t = (g-test->green))<0 ) t = -t; best += t; -- if (( t = (b-test->blue))<0 ) t = -t; best += t; -+ if (( best = (r-test->red))<0 ) -+ best = -best; -+ if (( t = (g-test->green))<0 ) -+ t = -t; -+ best += t; -+ if (( t = (b-test->blue))<0 ) -+ t = -t; -+ best += t; - bestcol = test; - for ( test=test->next; test!=NULL; test = test->next ) { -- if (( val = (r-test->red))<0 ) val = -val; -- if (( t = (g-test->green))<0 ) t = -t; val += t; -- if (( t = (b-test->blue))<0 ) t = -t; val += t; -+ if (( val = (r-test->red))<0 ) -+ val = -val; -+ if (( t = (g-test->green))<0 ) -+ t = -t; -+ val += t; -+ if (( t = (b-test->blue))<0 ) -+ t = -t; -+ val += t; - if ( valnext==NULL && this->cols[1]==NULL ) - return( (GCol *) test ); - -- if (( best = (r-test->red))<0 ) best = -best; -- if (( t = (g-test->green))<0 ) t = -t; best += t; -- if (( t = (b-test->blue))<0 ) t = -t; best += t; -+ if (( best = (r-test->red))<0 ) -+ best = -best; -+ if (( t = (g-test->green))<0 ) -+ t = -t; -+ best += t; -+ if (( t = (b-test->blue))<0 ) -+ t = -t; -+ best += t; - bestcol = test; - for ( test=test->next; test!=NULL; test = test->next ) { -- if (( val = (r-test->red))<0 ) val = -val; -- if (( t = (g-test->green))<0 ) t = -t; val += t; -- if (( t = (b-test->blue))<0 ) t = -t; val += t; -+ if (( val = (r-test->red))<0 ) -+ val = -val; -+ if (( t = (g-test->green))<0 ) -+ t = -t; -+ val += t; -+ if (( t = (b-test->blue))<0 ) -+ t = -t; -+ val += t; - if ( valcols[1]; test!=NULL; test = test->next ) { -- if (( val = (r-test->red))<0 ) val = -val; -- if (( t = (g-test->green))<0 ) t = -t; val += t; -- if (( t = (b-test->blue))<0 ) t = -t; val += t; -+ if (( val = (r-test->red))<0 ) -+ val = -val; -+ if (( t = (g-test->green))<0 ) -+ t = -t; -+ val += t; -+ if (( t = (b-test->blue))<0 ) -+ t = -t; -+ val += t; - if ( valnext ) { -- if ( (off = (r-test->red))<0 ) off = -off; -- if ( (t = (g-test->green))<0 ) t = -t; off +=t; -- if ( (b = (g-test->blue))<0 ) t = -t; off +=t; -+ if ( (off = (r-test->red))<0 ) -+ off = -off; -+ if ( (t = (g-test->green))<0 ) -+ t = -t; -+ off +=t; -+ if ( (b = (g-test->blue))<0 ) -+ t = -t; -+ off +=t; - if ( offred))<0 ) off = -off; -- if ( (t = (g-old->green))<0 ) t = -t; off +=t; -- if ( (b = (g-old->blue))<0 ) t = -t; off +=t; -+ if ( (off = (r-old->red))<0 ) -+ off = -off; -+ if ( (t = (g-old->green))<0 ) -+ t = -t; -+ off +=t; -+ if ( (b = (g-old->blue))<0 ) -+ t = -t; -+ off +=t; - if ( off=12) ? rq.point_size-2 : rq.point_size>=10 ? rq.point_size-1 : rq.point_size; - rq.weight = 700; -- gmatrixedit_titfont = GResourceFindFont("GMatrixEdit.TitleFont",GDrawInstanciateFont(NULL,&rq)); -+ gtitfont = GDrawInstanciateFont(NULL,&rq); -+ gmatrixedit_titfont = GResourceFindFont("GMatrixEdit.TitleFont",gtitfont); - gmatrixedit_title_bg = GResourceFindColor("GMatrixEdit.TitleBG",gmatrixedit_title_bg); - gmatrixedit_title_fg = GResourceFindColor("GMatrixEdit.TitleFG",gmatrixedit_title_fg); - gmatrixedit_title_divider = GResourceFindColor("GMatrixEdit.TitleDivider",gmatrixedit_title_divider); -diff -urN fontforge-20170731.old/gdraw/gmenu.c fontforge-20170731/gdraw/gmenu.c ---- fontforge-20170731.old/gdraw/gmenu.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gdraw/gmenu.c 2018-09-23 14:50:31.596567096 +0530 -@@ -145,6 +145,7 @@ - menu_3d_look = GResourceFindBool("GMenu.3DLook", menu_3d_look); - gmenubar_inited = true; - _GGroup_Init(); -+ free(keystr); - } - - typedef struct gmenu { -@@ -388,8 +389,12 @@ - strcat(buffer,"."); - if( stack[i]->ti.text_untranslated ) - { --// TRACE("adding %s\n", HKTextInfoToUntranslatedTextFromTextInfo( &stack[i]->ti )); -- strcat( buffer, HKTextInfoToUntranslatedTextFromTextInfo( &stack[i]->ti )); -+ char *res; -+ res = calloc(PATH_MAX, sizeof(char)); -+ res = HKTextInfoToUntranslatedTextFromTextInfo( &stack[i]->ti ); -+// TRACE("adding %s\n", res); -+ strcat( buffer, res); -+ free(res); - } - else if( stack[i]->ti.text ) - { -diff -urN fontforge-20170731.old/gdraw/gpstxtinit.c fontforge-20170731/gdraw/gpstxtinit.c ---- fontforge-20170731.old/gdraw/gpstxtinit.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gdraw/gpstxtinit.c 2018-09-23 14:50:31.596567096 +0530 -@@ -503,6 +503,7 @@ - } - } - fonts->names_loaded = true; -+ free(path); - return( fonts->names_loaded ); - } - -diff -urN fontforge-20170731.old/gdraw/gtextinfo.c fontforge-20170731/gdraw/gtextinfo.c ---- fontforge-20170731.old/gdraw/gtextinfo.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gdraw/gtextinfo.c 2018-09-23 14:50:31.597567080 +0530 -@@ -582,6 +582,7 @@ - free(fname); - ri->filename = fname = absname; - } -+ free(absname); - } - if ( ret==NULL ) { - ri->filename = NULL; -diff -urN fontforge-20170731.old/gdraw/gxdraw.c fontforge-20170731/gdraw/gxdraw.c ---- fontforge-20170731.old/gdraw/gxdraw.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gdraw/gxdraw.c 2018-09-23 14:50:31.597567080 +0530 -@@ -910,7 +910,6 @@ - } - if ( (wattrs->mask&wam_ititle) && wattrs->icon_title!=NULL ) { - XmbSetWMProperties(display,nw->w,NULL,(pt = u2def_copy(wattrs->icon_title)),NULL,0,NULL,NULL,NULL); -- free(pt); - } - if ( (wattrs->mask&wam_utf8_wtitle) && wattrs->utf8_window_title!=NULL ) { - #ifdef X_HAVE_UTF8_STRING -@@ -918,7 +917,7 @@ - #else - unichar_t *tit = utf82u_copy(wattrs->utf8_window_title); - XmbSetWMProperties(display,nw->w,(pt = u2def_copy(tit)),NULL,NULL,0,NULL,NULL,NULL); -- free(pt); free(tit); -+ free(tit); - #endif - } - if ( (wattrs->mask&wam_utf8_ititle) && wattrs->utf8_icon_title!=NULL ) { -@@ -927,7 +926,7 @@ - #else - unichar_t *tit = utf82u_copy(wattrs->utf8_icon_title); - XmbSetWMProperties(display,nw->w,NULL,(pt = u2def_copy(tit)),NULL,0,NULL,NULL,NULL); -- free(pt); free(tit); -+ free(tit); - #endif - } - s_h.x = pos->x; s_h.y = pos->y; -diff -urN fontforge-20170731.old/gutils/gimagereadrgb.c fontforge-20170731/gutils/gimagereadrgb.c ---- fontforge-20170731.old/gutils/gimagereadrgb.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gutils/gimagereadrgb.c 2018-09-23 14:50:31.597567080 +0530 -@@ -313,6 +313,7 @@ - free(r); free(g); free(b); free(a); - } - } -+ free(fp); - return( ret ); - - errorGImageReadRgbFile: -diff -urN fontforge-20170731.old/gutils/gioftp.c fontforge-20170731/gutils/gioftp.c ---- fontforge-20170731.old/gutils/gioftp.c 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/gutils/gioftp.c 2018-09-23 14:50:31.598567065 +0530 -@@ -697,6 +697,7 @@ - if ( ctl!=-1 ) close(ctl); - free(path); - free(host); free(username); free(password); -+ free(had); - return( NULL ); - } - -diff -urN fontforge-20170731.old/pycontrib/FontCompare/fc/GlyphConsistency.py fontforge-20170731/pycontrib/FontCompare/fc/GlyphConsistency.py ---- fontforge-20170731.old/pycontrib/FontCompare/fc/GlyphConsistency.py 2018-09-21 13:53:18.533769952 +0530 -+++ fontforge-20170731/pycontrib/FontCompare/fc/GlyphConsistency.py 2018-09-23 14:50:31.598567065 +0530 -@@ -83,7 +83,7 @@ - if not font[i].boundingBox()[3] in ymax_cords: - ymax_cords.append(font[i].boundingBox()[3]) - if not font[i].left_side_bearing in lbearing: -- rbearing.append(font[i].left_side_bearing) -+ lbearing.append(font[i].left_side_bearing) - if not font[i].right_side_bearing in rbearing: - rbearing.append(font[i].right_side_bearing) - if not font[i].layer_cnt in layer_cnts: diff --git a/SOURCES/fontforge-20170731-cve-2020-5395-followup-fix.patch b/SOURCES/fontforge-20170731-cve-2020-5395-followup-fix.patch deleted file mode 100644 index c69bb48..0000000 --- a/SOURCES/fontforge-20170731-cve-2020-5395-followup-fix.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b96273acc691ac8a36c6a8dd4de8e6edd7eaae59 Mon Sep 17 00:00:00 2001 -From: Fredrick Brennan -Date: Tue, 21 Jan 2020 15:16:00 +0800 -Subject: [PATCH] Fix crash on exit introduced in previous commit - -When the number of layers is greater than 2, as in Chomsky.sfd and most -of my other fonts, FontForge will crash on exiting. - -This is just a simple mistake @skef made. ---- - fontforge/sfd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fontforge/sfd.c b/fontforge/sfd.c -index e8ca39ba83..9517d8cb12 100644 ---- a/fontforge/sfd.c -+++ b/fontforge/sfd.c -@@ -7998,9 +7998,9 @@ bool SFD_GetFontMetaData( FILE *sfd, - int layer_cnt_tmp; - getint(sfd,&layer_cnt_tmp); - if ( layer_cnt_tmp>2 ) { -+ sf->layer_cnt = layer_cnt_tmp; - sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo)); - memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo)); -- sf->layer_cnt = layer_cnt_tmp; - } - } - else if ( strmatch(tok,"Layer:")==0 ) diff --git a/SOURCES/fontforge-20170731-cve-2020-5395.patch b/SOURCES/fontforge-20170731-cve-2020-5395.patch deleted file mode 100644 index 51b5245..0000000 --- a/SOURCES/fontforge-20170731-cve-2020-5395.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 048a91e2682c1a8936ae34dbc7bd70291ec05410 Mon Sep 17 00:00:00 2001 -From: Skef Iterum -Date: Mon, 6 Jan 2020 03:05:06 -0800 -Subject: [PATCH] Fix for #4084 Use-after-free (heap) in the - SFD_GetFontMetaData() function Fix for #4086 NULL pointer dereference in the - SFDGetSpiros() function Fix for #4088 NULL pointer dereference in the - SFD_AssignLookups() function Add empty sf->fontname string if it isn't set, - fixing #4089 #4090 and many other potential issues (many downstream calls - to strlen() on the value). - ---- - fontforge/sfd.c | 19 ++++++++++++++----- - fontforge/sfd1.c | 2 +- - 2 files changed, 15 insertions(+), 6 deletions(-) - -diff --git a/fontforge/sfd.c b/fontforge/sfd.c -index 731be201e0..e8ca39ba83 100644 ---- a/fontforge/sfd.c -+++ b/fontforge/sfd.c -@@ -4032,13 +4032,16 @@ static void SFDGetSpiros(FILE *sfd,SplineSet *cur) { - while ( fscanf(sfd,"%lg %lg %c", &cp.x, &cp.y, &cp.ty )==3 ) { - if ( cur!=NULL ) { - if ( cur->spiro_cnt>=cur->spiro_max ) -- cur->spiros = realloc(cur->spiros,(cur->spiro_max+=10)*sizeof(spiro_cp)); -+ cur->spiros = realloc(cur->spiros, -+ (cur->spiro_max+=10)*sizeof(spiro_cp)); - cur->spiros[cur->spiro_cnt++] = cp; - } - } -- if ( cur!=NULL && (cur->spiros[cur->spiro_cnt-1].ty&0x7f)!=SPIRO_END ) { -+ if ( cur!=NULL && cur->spiro_cnt>0 -+ && (cur->spiros[cur->spiro_cnt-1].ty&0x7f)!=SPIRO_END ) { - if ( cur->spiro_cnt>=cur->spiro_max ) -- cur->spiros = realloc(cur->spiros,(cur->spiro_max+=1)*sizeof(spiro_cp)); -+ cur->spiros = realloc(cur->spiros, -+ (cur->spiro_max+=1)*sizeof(spiro_cp)); - memset(&cur->spiros[cur->spiro_cnt],0,sizeof(spiro_cp)); - cur->spiros[cur->spiro_cnt++].ty = SPIRO_END; - } -@@ -7992,10 +7995,12 @@ bool SFD_GetFontMetaData( FILE *sfd, - else if ( strmatch(tok,"LayerCount:")==0 ) - { - d->had_layer_cnt = true; -- getint(sfd,&sf->layer_cnt); -- if ( sf->layer_cnt>2 ) { -+ int layer_cnt_tmp; -+ getint(sfd,&layer_cnt_tmp); -+ if ( layer_cnt_tmp>2 ) { - sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo)); - memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo)); -+ sf->layer_cnt = layer_cnt_tmp; - } - } - else if ( strmatch(tok,"Layer:")==0 ) -@@ -8948,6 +8953,10 @@ exit( 1 ); - } - } - -+ // Many downstream functions assume this isn't NULL (use strlen, etc.) -+ if ( sf->fontname==NULL) -+ sf->fontname = copy(""); -+ - if ( fromdir ) - sf = SFD_FigureDirType(sf,tok,dirname,enc,remap,had_layer_cnt); - else if ( sf->subfontcnt!=0 ) { -diff --git a/fontforge/sfd1.c b/fontforge/sfd1.c -index cf931059d0..b42f832678 100644 ---- a/fontforge/sfd1.c -+++ b/fontforge/sfd1.c -@@ -674,7 +674,7 @@ void SFD_AssignLookups(SplineFont1 *sf) { - - /* Fix up some gunk from really old versions of the sfd format */ - SFDCleanupAnchorClasses(&sf->sf); -- if ( sf->sf.uni_interp==ui_unset ) -+ if ( sf->sf.uni_interp==ui_unset && sf->sf.map!=NULL ) - sf->sf.uni_interp = interp_from_encoding(sf->sf.map->enc,ui_none); - - /* Fixup for an old bug */ diff --git a/SOURCES/fontforge-20170731-override-upstream-optimization-flags-splinerefigure-c.patch b/SOURCES/fontforge-20170731-override-upstream-optimization-flags-splinerefigure-c.patch deleted file mode 100644 index 5ba528e..0000000 --- a/SOURCES/fontforge-20170731-override-upstream-optimization-flags-splinerefigure-c.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN fontforge-20170731.old/fontforge/Makefile.am fontforge-20170731/fontforge/Makefile.am ---- fontforge-20170731.old/fontforge/Makefile.am 2017-07-31 03:19:01.000000000 +0530 -+++ fontforge-20170731/fontforge/Makefile.am 2019-06-01 23:35:57.644257299 +0530 -@@ -192,7 +192,7 @@ - # without optimization. - splinerefigure.lo: $(srcdir)/splinerefigure.c $(srcdir)/splinefont.h - $(LIBTOOL) --mode=compile $(CC) $(RAW_COMPILE_PLATFORM_CFLAGS) -g -c -o \ -- splinerefigure.lo $(AM_CPPFLAGS) $(srcdir)/splinerefigure.c -+ splinerefigure.lo $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/splinerefigure.c - - #-------------------------------------------------------------------------- - EXTRA_DIST = generate_codepoint_selector.py threaddummy.c diff --git a/SOURCES/fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch b/SOURCES/fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch new file mode 100644 index 0000000..6c1e797 --- /dev/null +++ b/SOURCES/fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch @@ -0,0 +1,27 @@ +From ee14a6389d19e2f45219134058e07f10585fa6d3 Mon Sep 17 00:00:00 2001 +From: Jeremy Tan +Date: Thu, 2 Apr 2020 18:03:47 +0800 +Subject: [PATCH] Call gdk_set_allowed_backends before gdk_init + +Fixes #4247 +--- + fontforgeexe/startui.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fontforgeexe/startui.c b/fontforgeexe/startui.c +index 06f5200a4..114bb7fb6 100644 +--- a/fontforgeexe/startui.c ++++ b/fontforgeexe/startui.c +@@ -1182,8 +1182,8 @@ int fontforge_main( int argc, char **argv ) { + #endif + } + #ifdef FONTFORGE_CAN_USE_GDK +- gdk_init(&argc, &argv); + gdk_set_allowed_backends("win32,quartz,x11"); ++ gdk_init(&argc, &argv); + #endif + ensureDotFontForgeIsSetup(); + #if defined(__MINGW32__) && !defined(_NO_LIBCAIRO) +-- +2.26.0 + diff --git a/SOURCES/fontforge-20200314-minor-backward-compatible-sphinx-changes.patch b/SOURCES/fontforge-20200314-minor-backward-compatible-sphinx-changes.patch new file mode 100644 index 0000000..e73412e --- /dev/null +++ b/SOURCES/fontforge-20200314-minor-backward-compatible-sphinx-changes.patch @@ -0,0 +1,161 @@ +From 1a03ca2de0b4c99ee72b330b56e89cc90fe773ae Mon Sep 17 00:00:00 2001 +From: Jeremy Tan +Date: Sat, 4 Apr 2020 11:43:34 +1100 +Subject: [PATCH] Minor changes for backwards compatibility with older versions + of Sphinx + +Closes #4256 +--- + doc/sphinx/conf.py | 3 +++ + doc/sphinx/techref/splinefont.rst | 26 ++++++++++++------------- + doc/sphinx/ui/misc/fontforge-themes.rst | 2 +- + 3 files changed, 17 insertions(+), 14 deletions(-) + +diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py +index 4b22e2eaf6..f2df68676e 100644 +--- a/doc/sphinx/conf.py ++++ b/doc/sphinx/conf.py +@@ -68,6 +68,9 @@ + # Don't copy source rst files into the output + html_copy_source = False + ++# Set the main page ++master_doc = 'index' ++ + # Custom roles must be in the prolog, not the epilog! + rst_prolog = ''' + .. role:: small +diff --git a/doc/sphinx/techref/splinefont.rst b/doc/sphinx/techref/splinefont.rst +index 98248f7a5e..60399d3912 100644 +--- a/doc/sphinx/techref/splinefont.rst ++++ b/doc/sphinx/techref/splinefont.rst +@@ -195,7 +195,7 @@ The bounding box of a :ref:`Spline `, + :ref:`SplineChar `, :ref:`RefChar `, + :ref:`Image `, or whatever else needs a bounding box. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.BDFFloat + + typedef struct bdffloat { +@@ -206,7 +206,7 @@ The bounding box of a :ref:`Spline `, + + The floating selection in a :ref:`BDFChar `. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.Undoes + + typedef struct undoes { +@@ -277,7 +277,7 @@ both the splines and the bitmaps of a character. + ut_mult is used when doing a copy from the FontView where you are copying more + than one character. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.BDFChar + + typedef struct bdfchar { +@@ -318,7 +318,7 @@ represented by a byte rather than a bit. There is a clut for this in the BDFFont + The last thing in the BDFChar is a (/an optional) floating selection. Only + present if the user has made a selection or done a paste or something like that. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.BDFFont + + typedef struct bdffont { +@@ -345,7 +345,7 @@ contains a count of the number of entries in the array, and then the array + itself. Currently the number of entries here is always 16, but that could + change. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.SplinePoint + + enum pointtype { pt_curve, pt_corner, pt_tangent }; +@@ -405,7 +405,7 @@ drawing it. They are cached so they don't need to be regenerated each time. + There's a different set of lines for every scale (as there is a different amount + of visible detail). They get freed and regenerated if the Spline changes. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.Spline + + typedef struct spline1d { +@@ -439,7 +439,7 @@ some are used in other places too. + The Spline1D structures give the equations for the x and y coordinates + respectively (splines[0] is for x, splines[1] is for y). + +-.. code-block:: ++.. code-block:: default + :name: splinefont.SplinePointList + + typedef struct splinepointlist { +@@ -463,7 +463,7 @@ to). A SplinePointList is a connected path. There are three cases: + Generally a series of paths will make up a character, and they are linked + together on the next field. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.RefChar + + typedef struct refchar { +@@ -498,7 +498,7 @@ themselves). The selected field indicates that the reference is selected. The bb + field provides a transformed bounding box. And the sc field points to the + SplineChar we are referring to. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.KernPair + + typedef struct kernpair { +@@ -514,7 +514,7 @@ offset between them (or rather the difference from what their respective left + and right bearings would lead you to believe it should be). Next points to the + next kernpair. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.Hints + + typedef struct hints { +@@ -532,7 +532,7 @@ y space) of where the stem starts, and width is how long it is. Width may be + negative (in which case base is where the stem ends). Next points to the next + hint for the character. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.ImageList + + typedef struct imagelist { +@@ -551,7 +551,7 @@ not support any other transformations on images). The bounding box is after the + transformations have been applied. The next field points to the next image, and + selected indicates whether this one is selected or not. + +-.. code-block:: ++.. code-block:: default + :name: splinefont.SplineChar + + typedef struct splinechar { +@@ -623,7 +623,7 @@ follow this one. For instance the combination "VA" might need kerning, then the + SplineChar representing "V" would have a pointer to a + :ref:`KernPair ` with data on "A". + +-.. code-block:: ++.. code-block:: default + :name: splinefont.SplineFont + + typedef struct splinefont { +diff --git a/doc/sphinx/ui/misc/fontforge-themes.rst b/doc/sphinx/ui/misc/fontforge-themes.rst +index 8df505634f..5bf3f6edd5 100644 +--- a/doc/sphinx/ui/misc/fontforge-themes.rst ++++ b/doc/sphinx/ui/misc/fontforge-themes.rst +@@ -4,7 +4,7 @@ FontForge color schemes + The following are some suggestions for color schemes. You simply copy these into + your ~/.Xdefaults file and then run + +-.. code-block:: ++.. code-block:: default + :name: fontforge-themes.shell + + $ xrdb ~/.Xdefaults diff --git a/SPECS/fontforge.spec b/SPECS/fontforge.spec index 1b63c2d..97c58d3 100644 --- a/SPECS/fontforge.spec +++ b/SPECS/fontforge.spec @@ -1,34 +1,26 @@ %global gettext_package FontForge -%global gnulib_githead 2bf7326 -%global gittag0 20170731 +%global gittag0 20200314 Name: fontforge -Version: %{gittag0} -Release: 15%{?dist} +Version: 20200314 +Release: 5%{?dist} Summary: Outline and bitmap font editor License: GPLv3+ URL: http://fontforge.github.io/ Source0: https://github.com/fontforge/%{name}/archive/%{gittag0}.tar.gz#/%{name}-%{version}.tar.gz -# https://github.com/fontforge/fontforge/issues/1725 -Source1: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=%{gnulib_githead};sf=tgz;name=gnulib-%{gnulib_githead}.tar.gz -# https://github.com/fontforge/fontforge/pull/1723 -Patch0: fontforge-20140813-use-system-uthash.patch -# Fedora specific patch to have python3 support only -Patch1: Add-python3-support.patch -Patch2: fontforge-20170731-covscan-issue-fix.patch -Patch3: fontforge-20170731-override-upstream-optimization-flags-splinerefigure-c.patch -# https://github.com/fontforge/fontforge/issues/4084 -Patch4: fontforge-20170731-cve-2020-5395.patch -# https://github.com/fontforge/fontforge/issues/4164 -Patch5: fontforge-20170731-cve-2020-5395-followup-fix.patch + +# https://github.com/fontforge/fontforge/pull/4253 +Patch0: fontforge-20200314-Call-gdk_set_allowed_backends-before-gdk_init.patch +# https://github.com/fontforge/fontforge/pull/4257 +Patch1: fontforge-20200314-minor-backward-compatible-sphinx-changes.patch Requires: xdg-utils Requires: autotrace Requires: hicolor-icon-theme -BuildRequires: gcc -BuildRequires: git +BuildRequires: gcc-c++ +BuildRequires: cmake BuildRequires: libjpeg-devel BuildRequires: libtiff-devel BuildRequires: libpng-devel @@ -44,16 +36,13 @@ BuildRequires: pango-devel BuildRequires: cairo-devel BuildRequires: libspiro-devel BuildRequires: python3-devel -BuildRequires: libtool-ltdl-devel -BuildRequires: libtool BuildRequires: readline-devel -# This is failing on aarch64 so drop it -#BuildRequires: python-ipython -BuildRequires: uthash-devel +BuildRequires: libappstream-glib # F25 build is failing add following to fix BuildRequires: shared-mime-info - -Provides: bundled(gnulib) +# F33 onward need now +BuildRequires: gtk3-devel +BuildRequires: python3-sphinx %description FontForge (former PfaEdit) is a font editor for outline and bitmap @@ -62,14 +51,13 @@ fonts. It supports a range of font formats, including PostScript (Type2) and CID-keyed fonts. %package devel -Summary: Development tools for fontforge -Requires: %{name} = %{version}-%{release} +Summary: Development files for fontforge +Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-doc = %{version}-%{release} -Requires: pkgconfig %description devel -This package includes the libraries and header files you will need -to compile applications against fontforge. +This package includes the library files you will need to compile +applications against fontforge. %package doc Summary: Documentation files for %{name} @@ -80,92 +68,88 @@ This package contains documentation files for %{name}. %prep -%autosetup -p1 -tar xzf %{SOURCE1} - -sed -i -e '/^#!\//, 1d' pycontrib/webcollab.py - -mkdir htdocs -cp -pr doc/html/* htdocs -chmod 644 htdocs/nonBMP/index.html -# Fix bad line terminators -%{__sed} -i 's/\r//' htdocs/Big5.txt -%{__sed} -i 's/\r//' htdocs/corpchar.txt +%setup -q +%patch0 -p1 +%patch1 -p1 + +# Remove tests that requires Internet access +sed -i '45d;83d;101d;102d;114d;115d;125d' tests/CMakeLists.txt +rm tests/test003.pe tests/test130.pe tests/test0101.py tests/test929.py +# Remove tests for s390x +rm tests/test0004.py tests/test1009.py tests/test1010.py +# Remove desktop-file-validate warning +sed -i '5d' desktop/org.fontforge.FontForge.desktop %build -./bootstrap --skip-git --gnulib-srcdir=gnulib-%{gnulib_githead} +rm -rf build && mkdir build +pushd build export CFLAGS="%{optflags} -fno-strict-aliasing" -%configure PYTHON=python3 -make V=1 %{?_smp_mflags} +%cmake .. -DCMAKE_BUILD_TYPE=Release + +%{make_build} +popd %install -make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" -rm -f $RPM_BUILD_ROOT%{_libdir}/libg{draw,unicode}.{la,so} +pushd build +%{make_install} +popd + desktop-file-install \ --dir $RPM_BUILD_ROOT%{_datadir}/applications \ --add-category X-Fedora \ - desktop/fontforge.desktop - -# The fontforge makefiles install htdocs as well, but we -# prefer to have them under the standard RPM location, so -# remove the extra copy -rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/fontforge + desktop/org.fontforge.FontForge.desktop # remove unneeded .la and .a files find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';' +rm -f %{buildroot}%{_datadir}/doc/fontforge/{.buildinfo,.nojekyll} +appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml + # Find translations %find_lang %{gettext_package} -mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata -install -m 644 -p desktop/fontforge.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata - -mkdir -p $RPM_BUILD_ROOT%{_datadir}/mime/packages -install -m 644 -p desktop/fontforge.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/ - -#Makefile install rules are playing evil here. Let's correct the permission. -#chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/python/graphicore/__init__.py -chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/python/gdraw/_gdraw.py - -chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/css/*.css -chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/js/*.js -chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/js/contentEditable/* - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig +%check +pushd build +make check +popd %files -f %{gettext_package}.lang %doc AUTHORS -%license LICENSE +%license LICENSE COPYING.gplv3 %{_bindir}/* %{_libdir}/lib*.so.* -%{_datadir}/applications/*fontforge.desktop +%{_datadir}/applications/*FontForge.desktop %{_datadir}/fontforge -%{_datadir}/icons/hicolor/*/apps/fontforge.* +%{_datadir}/icons/hicolor/*/apps/org.fontforge.FontForge* %{_mandir}/man1/*.1* +%{_datadir}/pixmaps/org.fontforge.FontForge* %{_datadir}/mime/packages/fontforge.xml -%{_datadir}/appdata/fontforge.appdata.xml +%{_metainfodir}/org.fontforge.FontForge.appdata.xml %{python3_sitearch}/fontforge.so %{python3_sitearch}/psMat.so %files devel -%{_includedir}/fontforge/ %{_libdir}/lib*.so -%{_libdir}/pkgconfig/*.pc %files doc -%doc htdocs +%doc %{_pkgdocdir} %changelog +* Mon Dec 14 2020 Parag Nemade - 20200314-5 +- The %%find_lang should run as part of %%install only + +* Mon Dec 07 2020 Parag Nemade - 20200314-4 +- Minor changes for backwards compatibility with older versions of Sphinx + Resolves: rhbz#1646212 + * Wed Apr 08 2020 Parag Nemade - 20170731-15 -- Resolves:rh#1821664 - CVE-2020-5395:out-of-bounds write in sfd.c +- Resolves:rh#1821664 - out-of-bounds write in sfd.c * Thu Jan 16 2020 Parag Nemade - 20170731-14 -- Resolves:rh#1790974 - CVE-2020-5395:out-of-bounds write in sfd.c +- Resolves:rh#1790974 - out-of-bounds write in sfd.c * Sun Jun 02 2019 Parag Nemade - 20170731-13 - Resolves:rh#1665940 - harden the missing splinerefigure.c file @@ -188,9 +172,6 @@ chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/nodejs/collabwebview/js/contentEd * Sat Sep 22 2018 Parag Nemade - 20170731-7 - Resolves:rh#1602497 - Fix some covscan issues -* Mon Jul 23 2018 Ray Strode - 20170731-6 -- Drop gnulib BuildReq - * Sun Feb 11 2018 Sandro Mani - 20170731-5 - Rebuild (giflib)