Blame SOURCES/fontforge-20170731-covscan-issue-fix.patch

1917f8
diff -urN fontforge-20170731.old/fontforge/asmfpst.c fontforge-20170731/fontforge/asmfpst.c
1917f8
--- fontforge-20170731.old/fontforge/asmfpst.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/asmfpst.c	2018-09-23 14:50:31.558567689 +0530
1917f8
@@ -810,13 +810,16 @@
1917f8
     match_len = j;
1917f8
 
1917f8
     for ( i=0; i
1917f8
-	if ( tables[i]==NULL || tables[i][0]==NULL )
1917f8
-return( NULL );
1917f8
-
1917f8
+	if ( tables[i]==NULL || tables[i][0]==NULL ) {
1917f8
+		free(tables);
1917f8
+	        return( NULL );
1917f8
+	}
1917f8
     glyphs = morx_cg_FigureClasses(tables,match_len,
1917f8
 	    &classes,&class_cnt,&map,&gcnt,fpst,sf,ordered);
1917f8
-    if ( glyphs==NULL )
1917f8
-return( NULL );
1917f8
+    if ( glyphs==NULL ) {
1917f8
+	    free(tables);
1917f8
+	    return( NULL );
1917f8
+    }
1917f8
 
1917f8
     for ( i=0; i
1917f8
 	free(tables[i]);
1917f8
diff -urN fontforge-20170731.old/fontforge/autotrace.c fontforge-20170731/fontforge/autotrace.c
1917f8
--- fontforge-20170731.old/fontforge/autotrace.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/autotrace.c	2018-09-23 14:50:31.558567689 +0530
1917f8
@@ -474,8 +474,10 @@
1917f8
 	    ++cnt;
1917f8
 	    for ( start=pt; isspace(*start); ++start);
1917f8
 	}
1917f8
-	if ( cnt==0 )
1917f8
-return( NULL );
1917f8
+	if ( cnt==0 ) {
1917f8
+		free(vector);
1917f8
+		return( NULL );
1917f8
+	}
1917f8
 	if ( vector ) {
1917f8
 	    vector[cnt] = NULL;
1917f8
 return( vector );
1917f8
@@ -789,17 +791,17 @@
1917f8
     strcat(arglist[1],filename);
1917f8
     if ( (pid=fork())==0 ) {
1917f8
 	/* Child */
1917f8
-	int fd;
1917f8
+	int fdw, fdr;
1917f8
 	chdir(tempdir);
1917f8
 	if ( !mf_showerrors ) {
1917f8
 	    close(1);		/* mf generates a lot of verbiage to stdout. Throw it away */
1917f8
-	    fd = open("/dev/null",O_WRONLY);
1917f8
-	    if ( fd!=1 )
1917f8
-		dup2(fd,1);
1917f8
+	    fdw = open("/dev/null",O_WRONLY);
1917f8
+	    if ( fdw!=1 )
1917f8
+		dup2(fdw,1);
1917f8
 	    close(0);		/* mf sometimes asks the user questions, but I have no answers... */
1917f8
-	    fd = open("/dev/null",O_RDONLY);
1917f8
-	    if ( fd!=0 )
1917f8
-		dup2(fd,0);
1917f8
+	    fdr = open("/dev/null",O_RDONLY);
1917f8
+	    if ( fdr!=0 )
1917f8
+		dup2(fdr,0);
1917f8
 	}
1917f8
 	exit(execvp(arglist[0],arglist)==-1);	/* If exec fails, then die */
1917f8
     } else if ( pid!=-1 ) {
1917f8
@@ -836,6 +838,7 @@
1917f8
 	ff_post_error(_("Can't run mf"),_("Can't run mf"));
1917f8
     free(arglist[1]);
1917f8
     cleantempdir(tempdir);
1917f8
+    free(tempdir);
1917f8
 return( sf );
1917f8
 #endif
1917f8
 }
1917f8
diff -urN fontforge-20170731.old/fontforge/bitmapchar.c fontforge-20170731/fontforge/bitmapchar.c
1917f8
--- fontforge-20170731.old/fontforge/bitmapchar.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/bitmapchar.c	2018-09-23 14:50:31.558567689 +0530
1917f8
@@ -371,6 +371,8 @@
1917f8
 	    }
1917f8
 	}
1917f8
     }
1917f8
+    free(bpt);
1917f8
+    free(pt);
1917f8
 }
1917f8
 
1917f8
 BDFProperties *BdfPropsCopy(BDFProperties *props, int cnt ) {
1917f8
diff -urN fontforge-20170731.old/fontforge/cvimages.c fontforge-20170731/fontforge/cvimages.c
1917f8
--- fontforge-20170731.old/fontforge/cvimages.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/cvimages.c	2018-09-23 14:50:31.558567689 +0530
1917f8
@@ -223,11 +223,15 @@
1917f8
     break;
1917f8
 	if ( ch!='(' ) {
1917f8
 	    ff_post_error( _("Not a plate file"), _("This does not seem to be a plate file\nExpected left paren"));
1917f8
+	    free(head);
1917f8
+	    free(spiros);
1917f8
 return;
1917f8
 	}
1917f8
 	ch = getc(plate);
1917f8
 	if ( ch!='v' && ch!='o' && ch!='c' && ch!='[' && ch!=']' && ch!='z' ) {
1917f8
 	    ff_post_error( _("Not a plate file"), _("This does not seem to be a plate file\nExpected one of 'voc[]z'"));
1917f8
+	    free(head);
1917f8
+	    free(spiros);
1917f8
 return;
1917f8
 	}
1917f8
 	if ( cnt>=max )
1917f8
@@ -251,6 +255,8 @@
1917f8
 	} else {
1917f8
 	    if ( fscanf(plate,"%lg %lg )", &spiros[cnt].x, &spiros[cnt].y)!=2 ) {
1917f8
 		ff_post_error( _("Not a plate file"), _("This does not seem to be a plate file\nExpected two real numbers"));
1917f8
+		free(head);
1917f8
+		free(spiros);
1917f8
 return;
1917f8
 	    }
1917f8
 	    ++cnt;
1917f8
diff -urN fontforge-20170731.old/fontforge/cvundoes.c fontforge-20170731/fontforge/cvundoes.c
1917f8
--- fontforge-20170731.old/fontforge/cvundoes.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/cvundoes.c	2018-09-23 14:50:31.559567674 +0530
1917f8
@@ -2637,6 +2637,7 @@
1917f8
 	adjust->yadv.corrections = malloc(adjust->yadv.last_pixel_size-adjust->yadv.first_pixel_size+1);
1917f8
 	memcpy(adjust->yadv.corrections,vr->adjust->yadv.corrections,adjust->yadv.last_pixel_size-adjust->yadv.first_pixel_size+1);
1917f8
     }
1917f8
+    free(adjust);
1917f8
 }
1917f8
 
1917f8
 static void PSTInto(SplineChar *sc,PST *pst,PST *frompst, struct lookup_subtable *sub) {
1917f8
@@ -3898,6 +3899,7 @@
1917f8
     {
1917f8
 	char* str = UndoToString( sc, undo );
1917f8
 	printf("\n\n*** undo: %d\n%s\n", idx, str );
1917f8
+	free(str);
1917f8
     }
1917f8
     printf("dumpUndoChain(end) %s\n", msg );
1917f8
 }
1917f8
diff -urN fontforge-20170731.old/fontforge/encoding.c fontforge-20170731/fontforge/encoding.c
1917f8
--- fontforge-20170731.old/fontforge/encoding.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/encoding.c	2018-09-23 14:50:31.560567658 +0530
1917f8
@@ -757,6 +757,7 @@
1917f8
 	if ( item->enc_name==NULL ) {
1917f8
 	    if ( no_windowing_ui ) {
1917f8
 		ff_post_error(_("Bad encoding file format"),_("This file contains an unnamed encoding, which cannot be named in a script"));
1917f8
+		free(head);
1917f8
 		return( NULL );
1917f8
 	    }
1917f8
 	    if ( item==head && item->next==NULL )
1917f8
diff -urN fontforge-20170731.old/fontforge/featurefile.c fontforge-20170731/fontforge/featurefile.c
1917f8
--- fontforge-20170731.old/fontforge/featurefile.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/featurefile.c	2018-09-23 14:50:31.561567642 +0530
1917f8
@@ -1620,9 +1620,10 @@
1917f8
 	glyphs[lcnt].sc = NULL;
1917f8
     }
1917f8
 
1917f8
-    if ( !needsclasses && lcnt==0 && sf->mark_class_cnt==0 )
1917f8
+    if ( !needsclasses && lcnt==0 && sf->mark_class_cnt==0 ){
1917f8
+	    free(glyphs);
1917f8
 return;					/* No anchor positioning, no ligature carets */
1917f8
-
1917f8
+    }
1917f8
     if ( sf->mark_class_cnt!=0 ) {
1917f8
 	fprintf( out, "#Mark attachment classes (defined in GDEF, used in lookupflags)\n" );
1917f8
 	for ( i=1; i<sf->mark_class_cnt; ++i ) {
1917f8
@@ -1799,9 +1800,12 @@
1917f8
 				}
1917f8
 			}
1917f8
 		    }
1917f8
+		    free(langs);
1917f8
 		}
1917f8
 	    }
1917f8
+	    free(scripts);
1917f8
 	}
1917f8
+	free(feats);
1917f8
     }
1917f8
     if (has_DFLT) { dump_header_languagesystem_hash_fe((gpointer)"DFLT dflt", (gpointer)"", (gpointer)out); }
1917f8
     g_tree_foreach( ht, dump_header_languagesystem_hash_fe, out );
1917f8
@@ -3259,15 +3263,18 @@
1917f8
 	LogError(_("Expected '=' in glyph class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
1917f8
 	++tok->err_count;
1917f8
 	fea_skip_to_semi(tok);
1917f8
+	free(classname);
1917f8
 return;
1917f8
     }
1917f8
     fea_ParseTok(tok);
1917f8
     contents = fea_ParseGlyphClass(tok); // Make a list of referenced glyphs.
1917f8
     if ( contents==NULL ) {
1917f8
 	fea_skip_to_semi(tok);
1917f8
+	free(contents);
1917f8
 return;
1917f8
     }
1917f8
     fea_AddClassDef(tok,classname,copy(contents)); // Put the list into a class.
1917f8
+    free(contents);
1917f8
     fea_end_statement(tok);
1917f8
 }
1917f8
 
1917f8
@@ -3517,6 +3524,7 @@
1917f8
 	LogError(_("Expected name in anchor definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
1917f8
 	++tok->err_count;
1917f8
 	fea_skip_to_semi(tok);
1917f8
+	free(ap);
1917f8
 return;
1917f8
     }
1917f8
     for ( nap=tok->namedAnchors; nap!=NULL; nap=nap->next )
1917f8
@@ -3681,6 +3689,7 @@
1917f8
 	LogError(_("Expected class name in mark class definition on line %d of %s"), tok->line[tok->inc_depth], tok->filename[tok->inc_depth] );
1917f8
 	++tok->err_count;
1917f8
 	fea_skip_to_semi(tok);
1917f8
+	free(ap);
1917f8
 return;
1917f8
     }
1917f8
     gm = chunkalloc(sizeof(*gm));
1917f8
@@ -7092,6 +7101,7 @@
1917f8
     }
1917f8
     if ( f!=NULL && f->type == ft_feat_end )
1917f8
 	f = f->next;
1917f8
+    free(sl);
1917f8
 return( f );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/glyphcomp.c fontforge-20170731/fontforge/glyphcomp.c
1917f8
--- fontforge-20170731.old/fontforge/glyphcomp.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/glyphcomp.c	2018-09-23 14:50:31.562567627 +0530
1917f8
@@ -1414,7 +1414,10 @@
1917f8
 
1917f8
 static void NameCompare(struct font_diff *fd,const char *name1, const char *name2, char *id) {
1917f8
 
1917f8
-    if (!name1) name1=""; if (!name2) name2="";
1917f8
+    if (!name1) 
1917f8
+	    name1=""; 
1917f8
+    if (!name2) 
1917f8
+	    name2="";
1917f8
     if ( strcmp(name1,name2)!=0 ) {
1917f8
 	if ( !fd->top_diff )
1917f8
 	    fprintf( fd->diffs, "Names\n" );
1917f8
@@ -1442,7 +1445,10 @@
1917f8
 	int lang,int strid) {
1917f8
     char strnamebuf[200];
1917f8
 
1917f8
-    if (!name1) name1=""; if (!name2) name2="";
1917f8
+    if (!name1) 
1917f8
+	    name1=""; 
1917f8
+    if (!name2) 
1917f8
+	    name2="";
1917f8
     if ( strcmp(name1,name2)==0 )
1917f8
 return;
1917f8
     sprintf( strnamebuf, "%.90s %.90s", TTFNameIds(strid), MSLangString(lang));
1917f8
diff -urN fontforge-20170731.old/fontforge/http.c fontforge-20170731/fontforge/http.c
1917f8
--- fontforge-20170731.old/fontforge/http.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/http.c	2018-09-23 14:50:31.562567627 +0530
1917f8
@@ -540,7 +540,9 @@
1917f8
     if ( !findFTPhost(&addr, host, port)) {
1917f8
 	ff_progress_end_indicator();
1917f8
 	ff_post_error(_("Could not find host"),_("Could not find \"%s\"\nAre you connected to the internet?"), host );
1917f8
-	free( host ); free( filename );
1917f8
+	free( host ); 
1917f8
+	free( filename );
1917f8
+	free(password);
1917f8
 return( false );
1917f8
     }
1917f8
     soc = makeConnection(&addr);
1917f8
diff -urN fontforge-20170731.old/fontforge/lookups.c fontforge-20170731/fontforge/lookups.c
1917f8
--- fontforge-20170731.old/fontforge/lookups.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/lookups.c	2018-09-23 14:50:31.562567627 +0530
1917f8
@@ -4746,20 +4746,26 @@
1917f8
     break;
1917f8
 	start = lpt;
1917f8
 	if ( *start=='|' ) {
1917f8
-	    if ( fpst->type==pst_contextpos || fpst->type==pst_contextsub )
1917f8
-return( xasprintf( _("Separation marks only meaningful in contextual chaining lookups, starting at: %.20s..."), lpt ));
1917f8
+	    if ( fpst->type==pst_contextpos || fpst->type==pst_contextsub ){
1917f8
+		    free(parsed);
1917f8
+		return( xasprintf( _("Separation marks only meaningful in contextual chaining lookups, starting at: %.20s..."), lpt ));
1917f8
+	    }
1917f8
 	    if ( first==-1 )
1917f8
 		first = cnt;
1917f8
 	    else if ( last==-1 )
1917f8
 		last = cnt-1;
1917f8
-	    else
1917f8
-return( xasprintf( _("Too many separation marks, starting at: %.20s..."), lpt ));
1917f8
+	    else{
1917f8
+		    free(parsed);
1917f8
+		return( xasprintf( _("Too many separation marks, starting at: %.20s..."), lpt ));
1917f8
+	    }
1917f8
 	    ++lpt;
1917f8
     continue;
1917f8
 	} else if ( *start=='[' ) {
1917f8
 	    /* A coverage table */
1917f8
-	    if ( fpst->format!=pst_coverage && fpst->format!=pst_reversecoverage )
1917f8
-return( xasprintf( _("A coverage table was found in a glyph or class based contextual lookup, starting at: %.20s..."), lpt ));
1917f8
+	    if ( fpst->format!=pst_coverage && fpst->format!=pst_reversecoverage ){
1917f8
+		    free(parsed);
1917f8
+		return( xasprintf( _("A coverage table was found in a glyph or class based contextual lookup, starting at: %.20s..."), lpt ));
1917f8
+	    }
1917f8
 	    ++start;
1917f8
 	    for ( lpt = start; *lpt!='\0' && *lpt!=']'; ++lpt );
1917f8
 	    if ( *lpt!=']' )
1917f8
@@ -4788,9 +4794,10 @@
1917f8
 		    }
1917f8
 		    free(parsed[cnt].replacements);
1917f8
 		    parsed[cnt].replacements = newr;
1917f8
-		} else
1917f8
-return( xasprintf( _("There must be as many replacement glyphs as there are match glyphs: %s => %s"),
1917f8
+		} else{
1917f8
+		return( xasprintf( _("There must be as many replacement glyphs as there are match glyphs: %s => %s"),
1917f8
 		    parsed[cnt].entity, parsed[cnt].replacements));
1917f8
+		}
1917f8
     continue;
1917f8
 	    }
1917f8
 	} else if ( *start!='@' && *start!='<' && !(*start=='=' && start[1]=='>') ) {
1917f8
@@ -4802,14 +4809,18 @@
1917f8
 	    /* A reverse contextual chaining */
1917f8
 	    if ( fpst->format!=pst_reversecoverage )
1917f8
 return( xasprintf( _("No replacement lists may be specified in this contextual lookup, use a nested lookup instead, starting at: %.20s..."), lpt ));
1917f8
-	    if ( do_replacements )
1917f8
-return( xasprintf( _("Only one replacement list may be specified in a reverse contextual chaining lookup, starting at: %.20s..."), lpt ));
1917f8
+	    if ( do_replacements ) {
1917f8
+		    free(parsed);
1917f8
+		return( xasprintf( _("Only one replacement list may be specified in a reverse contextual chaining lookup, starting at: %.20s..."), lpt ));
1917f8
+	    }
1917f8
 	    do_replacements = true;
1917f8
 	    lpt += 2;
1917f8
 	} else {
1917f8
 	    /* A lookup invocation */
1917f8
-	    if ( fpst->format==pst_reversecoverage )
1917f8
-return( xasprintf( _("No lookups may be specified in a reverse contextual lookup (use a replacement list instead), starting at: %.20s..."), lpt ));
1917f8
+	    if ( fpst->format==pst_reversecoverage ){
1917f8
+		    free(parsed);
1917f8
+		return( xasprintf( _("No lookups may be specified in a reverse contextual lookup (use a replacement list instead), starting at: %.20s..."), lpt ));
1917f8
+	    }
1917f8
 
1917f8
 	    if ( *start=='@' ) {
1917f8
 		for ( lpt=start+1; isspace( *lpt ); ++lpt );
1917f8
@@ -4867,8 +4878,10 @@
1917f8
     ret = NULL;
1917f8
 
1917f8
     if ( !do_replacements && !anylookup ) {
1917f8
-	if ( fpst->format==pst_reversecoverage )
1917f8
-return( copy( _("A reverse contextual chaining lookup must have a set of replacement glyphs somewhere" )) );
1917f8
+	if ( fpst->format==pst_reversecoverage ) {
1917f8
+		free(parsed);
1917f8
+		return( copy( _("A reverse contextual chaining lookup must have a set of replacement glyphs somewhere" )) );
1917f8
+	}
1917f8
 	else {
1917f8
 	    *return_is_warning = true;
1917f8
 	    /* If there are no lookups then this rule matches and does nothing */
1917f8
@@ -4884,8 +4897,10 @@
1917f8
 	    if ( first==-1 ) first = i;
1917f8
 	}
1917f8
 	if ( parsed[i].replacements!=NULL ) {
1917f8
-	    if (( first!=-1 && first!=i ) || (last!=-1 && last!=i ))
1917f8
-return( copy( _("A reverse contextual chaining lookup can only match one coverage table directly" )) );
1917f8
+	    if (( first!=-1 && first!=i ) || (last!=-1 && last!=i )){
1917f8
+		    free(parsed);
1917f8
+		return( copy( _("A reverse contextual chaining lookup can only match one coverage table directly" )) );
1917f8
+	    }
1917f8
 	    first = last = i;
1917f8
 	}
1917f8
     }
1917f8
@@ -4977,11 +4992,13 @@
1917f8
 		free( rule->u.class.fclasses ); rule->u.class.fclasses = NULL;
1917f8
 		rule->u.class.bcnt = rule->u.class.fcnt = rule->u.class.ncnt = 0;
1917f8
 		if ( i
1917f8
-return( xasprintf( _("%s is not a class name for the backtracking classes." ), parsed[i].entity ) );
1917f8
-		else if ( i<=last )
1917f8
-return( xasprintf( _("%s is not a class name for the matching classes." ), parsed[i].entity ) );
1917f8
+			return( xasprintf( _("%s is not a class name for the backtracking classes." ), parsed[i].entity ) );
1917f8
+		else if ( i<=last ) {
1917f8
+			free(ret);
1917f8
+			return( xasprintf( _("%s is not a class name for the matching classes." ), parsed[i].entity ) );
1917f8
+		}
1917f8
 		else
1917f8
-return( xasprintf( _("%s is not a class name for the forward classes." ), parsed[i].entity ) );
1917f8
+			return( xasprintf( _("%s is not a class name for the forward classes." ), parsed[i].entity ) );
1917f8
 	    }
1917f8
 	    if ( i
1917f8
 		rule->u.class.bclasses[first-1-i] = j;	/* Reverse the backtrack classes */
1917f8
diff -urN fontforge-20170731.old/fontforge/macbinary.c fontforge-20170731/fontforge/macbinary.c
1917f8
--- fontforge-20170731.old/fontforge/macbinary.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/macbinary.c	2018-09-23 14:50:31.563567611 +0530
1917f8
@@ -299,7 +299,8 @@
1917f8
     for (;;) {
1917f8
 	if ( getc(pfbfile)!=0x80 ) {
1917f8
 	    IError("We made a pfb file, but didn't get one. Hunh?" );
1917f8
-return( NULL );
1917f8
+	    free(resstarts);
1917f8
+		return( NULL );
1917f8
 	}
1917f8
 	type = getc(pfbfile);
1917f8
 	if ( type==3 ) {
1917f8
@@ -1833,8 +1834,12 @@
1917f8
 		strcpy(pt-1,".fam.bin");
1917f8
 #endif
1917f8
 	    }
1917f8
-	    if ( WriteMacPSFont(tempname,sfi->sf,format,flags,sfi->map,layer)==0 )
1917f8
-return( 0 );
1917f8
+	    if ( WriteMacPSFont(tempname,sfi->sf,format,flags,sfi->map,layer)==0 ){
1917f8
+		    free(filename);
1917f8
+		    free(tempname);
1917f8
+		return( 0 );
1917f8
+		}
1917f8
+
1917f8
 	    free(tempname);
1917f8
 	}
1917f8
     } else if ( format!=ff_none || bf==bf_sfnt_dfont ) {
1917f8
@@ -1861,7 +1866,8 @@
1917f8
     if ( res==NULL ) {
1917f8
 	for ( sfsub=sfs; sfsub!=NULL; sfsub=sfsub->next )
1917f8
 	    fclose( sfsub->tempttf );
1917f8
-return( 0 );
1917f8
+	free(filename);
1917f8
+	return( 0 );
1917f8
     }
1917f8
 
1917f8
     if ( format==ff_ttfdfont || format==ff_otfdfont || format==ff_otfciddfont ||
1917f8
@@ -1982,8 +1988,9 @@
1917f8
     if ( pfb==NULL ) {
1917f8
 	LogError( _("Can't open temporary file for postscript output\n") );
1917f8
 	fseek(f,here,SEEK_SET );
1917f8
+	free(rsrcids);
1917f8
 	free(offsets);
1917f8
-return(NULL);
1917f8
+	return(NULL);
1917f8
     }
1917f8
 
1917f8
     putc(0x80,pfb);
1917f8
@@ -2578,7 +2585,9 @@
1917f8
     char *pt, *lparen;
1917f8
     char *find = NULL;
1917f8
 
1917f8
-    if ((pt = strrchr(filename,'/'))!=NULL ) pt = filename;
1917f8
+    if ((pt = strrchr(filename,'/'))!=NULL ) 
1917f8
+	    pt = filename;
1917f8
+
1917f8
     if ( (lparen = strchr(filename,'('))!=NULL && strchr(lparen,')')!=NULL ) {
1917f8
 	find = copy(lparen+1);
1917f8
 	pt = strchr(find,')');
1917f8
@@ -2588,6 +2597,8 @@
1917f8
 		if ( test->psnames[i]!=NULL && strcmp(find,test->psnames[i])==0 ) {
1917f8
 		    *style = (i&3) | ((i&~3)<<1);	/* PS styles skip underline bit */
1917f8
 		    *name = copy(test->psnames[i]);
1917f8
+    free(find);
1917f8
+    free(pt);
1917f8
 return( test );
1917f8
 		}
1917f8
 	}
1917f8
@@ -2670,8 +2681,10 @@
1917f8
     SplineChar *sc;
1917f8
 
1917f8
     fond = PickFOND(fondlist,filename,&name,&style);
1917f8
-    if ( fond==NULL )
1917f8
-return( NULL );
1917f8
+    if ( fond==NULL ){
1917f8
+	    free(name);
1917f8
+	return( NULL );
1917f8
+    }
1917f8
 
1917f8
     find_id=-1;
1917f8
     if ( flags&ttf_onlyonestrike ) {
1917f8
@@ -2747,8 +2760,11 @@
1917f8
     SplineChar *sc1, *sc2;
1917f8
 
1917f8
     fond = PickFOND(fondlist,filename,&name,&style);
1917f8
-    if ( fond==NULL || into==NULL )
1917f8
-return( NULL );
1917f8
+    if ( fond==NULL || into==NULL ){
1917f8
+	    free(name);
1917f8
+	return( NULL );
1917f8
+    }
1917f8
+
1917f8
     for ( i=0; i<fond->stylekerncnt; ++i )
1917f8
 	if ( fond->stylekerns[i].style==style )
1917f8
     break;
1917f8
@@ -2780,6 +2796,7 @@
1917f8
 	}
1917f8
 	kp->off = offset;
1917f8
     }
1917f8
+    free(name);
1917f8
 return( into );
1917f8
 }
1917f8
 
1917f8
@@ -2795,7 +2812,11 @@
1917f8
 	char **ret;
1917f8
 	char *temp = TTFGetFontName(binary,pos,pos);
1917f8
 	if ( temp==NULL )
1917f8
-return( NULL );
1917f8
+	{
1917f8
+		free(temp);
1917f8
+		free(buffer);
1917f8
+		return( NULL );
1917f8
+	}
1917f8
 	ret = malloc(2*sizeof(char *));
1917f8
 	ret[0] = temp;
1917f8
 	ret[1] = NULL;
1917f8
diff -urN fontforge-20170731.old/fontforge/palmfonts.c fontforge-20170731/fontforge/palmfonts.c
1917f8
--- fontforge-20170731.old/fontforge/palmfonts.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/palmfonts.c	2018-09-23 14:50:31.563567611 +0530
1917f8
@@ -178,6 +178,7 @@
1917f8
 	    BCCompressBitmap(bdfc);
1917f8
 	}
1917f8
     }
1917f8
+    free(fontImage);
1917f8
 }
1917f8
 
1917f8
 static SplineFont *PalmTestFont(FILE *file,int end, char *family,const char *style) {
1917f8
@@ -440,6 +441,7 @@
1917f8
 	putlong(file,0);
1917f8
 	putlong(file,0);
1917f8
     }
1917f8
+    free(pt1);
1917f8
 return(file);
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/parsepdf.c fontforge-20170731/fontforge/parsepdf.c
1917f8
--- fontforge-20170731.old/fontforge/parsepdf.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/parsepdf.c	2018-09-23 14:50:31.564567596 +0530
1917f8
@@ -974,8 +974,11 @@
1917f8
     while ( prev_xref!=-1 ) {
1917f8
 	if ( fseek(pdf,prev_xref,SEEK_SET)!=0 ) return( NULL );
1917f8
 	pdf_skipobjectheader(pc);
1917f8
-	if ( !pdf_readdict(pc))
1917f8
-return( NULL );
1917f8
+	if ( !pdf_readdict(pc)){
1917f8
+		free(gen);
1917f8
+		free(ret);
1917f8
+		return( NULL );
1917f8
+	}
1917f8
 	if ( (pt=PSDictHasEntry(&pc->pdfdict,"Type"))==NULL || strcmp(pt,"/XRef")!=0 )
1917f8
 return( NULL );
1917f8
 	if ( (pt=PSDictHasEntry(&pc->pdfdict,"Size"))==NULL )
1917f8
@@ -2069,6 +2072,7 @@
1917f8
     pcFree(&pc);
1917f8
     fclose(pc.pdf);
1917f8
     switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale.
1917f8
+    free(list);
1917f8
     return( NULL );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/parsettfatt.c fontforge-20170731/fontforge/parsettfatt.c
1917f8
--- fontforge-20170731.old/fontforge/parsettfatt.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/parsettfatt.c	2018-09-23 14:50:31.564567596 +0530
1917f8
@@ -790,6 +790,7 @@
1917f8
     if ( feof(ttf) ) {
1917f8
 	LogError( _("Bad mark table.\n") );
1917f8
 	info->bad_ot = true;
1917f8
+	free(classes);
1917f8
 return( NULL );
1917f8
     }
1917f8
 
1917f8
@@ -1386,6 +1387,7 @@
1917f8
 	if ( glyphs==NULL ) {
1917f8
 /* GT: This continues a multi-line error message, hence the leading space */
1917f8
 	    LogError( _(" Bad contextual substitution table, ignored\n") );
1917f8
+	    free(class);
1917f8
             free(rules);
1917f8
 return;
1917f8
 	}
1917f8
@@ -1543,6 +1545,7 @@
1917f8
 	if ( glyphs==NULL ) {
1917f8
 /* GT: This continues a multi-line error message, hence the leading space */
1917f8
 	    LogError( _(" Bad contextual chaining substitution table, ignored\n") );
1917f8
+	    free(class);
1917f8
             free(rules);
1917f8
 return;
1917f8
 	}
1917f8
@@ -2443,6 +2446,7 @@
1917f8
 	    if ( pos+scripts[i].languages[j].offset>=info->g_bounds ) {
1917f8
 		LogError(_("Attempt to read script data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
1917f8
 		info->bad_ot = true;
1917f8
+		free(scripts);
1917f8
 return( NULL );
1917f8
 	    }
1917f8
 	    fseek(ttf,pos+scripts[i].languages[j].offset,SEEK_SET);
1917f8
@@ -2452,6 +2456,7 @@
1917f8
 	    if ( feof(ttf)) {
1917f8
 		LogError(_("End of file when reading scripts in %s table"), isgpos ? "GPOS" : "GSUB" );
1917f8
 		info->bad_ot = true;
1917f8
+		free(scripts);
1917f8
 return( NULL );
1917f8
 	    }
1917f8
 	    scripts[i].languages[j].features = malloc(scripts[i].languages[j].fcnt*sizeof(uint16));
1917f8
@@ -2463,6 +2468,7 @@
1917f8
     if ( feof(ttf)) {
1917f8
 	LogError(_("End of file in %s table"), isgpos ? "GPOS" : "GSUB" );
1917f8
 	info->bad_ot = true;
1917f8
+	free(scripts);
1917f8
 return( NULL );
1917f8
     }
1917f8
 
1917f8
@@ -2502,6 +2508,7 @@
1917f8
 	if ( pos+features[i].offset>=info->g_bounds ) {
1917f8
 	    LogError(_("Attempt to read feature data beyond end of %s table"), isgpos ? "GPOS" : "GSUB" );
1917f8
 	    info->bad_ot = true;
1917f8
+	    free(features);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	fseek(ttf,pos+features[i].offset,SEEK_SET);
1917f8
@@ -2518,6 +2525,7 @@
1917f8
 	if ( feof(ttf) ) {
1917f8
 	    LogError(_("End of file when reading features in %s table"), isgpos ? "GPOS" : "GSUB" );
1917f8
 	    info->bad_ot = true;
1917f8
+	    free(features);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	features[i].lookups = malloc(features[i].lcnt*sizeof(uint16));
1917f8
@@ -2560,6 +2568,7 @@
1917f8
 	    LogError(_("Attempt to read lookup data beyond end of %s table"),
1917f8
 		    isgpos==2? "JSTF" : isgpos ? "GPOS" : "GSUB" );
1917f8
 	    info->bad_ot = true;
1917f8
+	    free(lookups);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	fseek(ttf,pos+lookups[i].offset,SEEK_SET);
1917f8
@@ -2585,6 +2594,7 @@
1917f8
 	if ( feof(ttf) ) {
1917f8
 	    LogError(_("End of file when reading lookups in %s table"), isgpos ? "GPOS" : "GSUB" );
1917f8
 	    info->bad_ot = true;
1917f8
+	    free(lookups);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	for ( j=0; j
1917f8
@@ -6063,6 +6073,7 @@
1917f8
 	    LogError( _("JSTF table is too long.\n") );
1917f8
 	    info->bad_ot = true;
1917f8
 	    free(soff);
1917f8
+	    free(loff);
1917f8
 return;
1917f8
 	}
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/parsettfbmf.c fontforge-20170731/fontforge/parsettfbmf.c
1917f8
--- fontforge-20170731.old/fontforge/parsettfbmf.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/parsettfbmf.c	2018-09-23 14:50:31.565567580 +0530
1917f8
@@ -91,8 +91,8 @@
1917f8
     /* Only use the provided metrics if it hasn't already been set */
1917f8
     if (metrics == NULL)
1917f8
 	metrics = &big;
1917f8
-	if ( imageformat==8 )
1917f8
-	    /* pad = */ getc(ttf);
1917f8
+    if ( imageformat==8 )
1917f8
+        /* pad = */ getc(ttf);
1917f8
     } else if ( imageformat==6 || imageformat==7 || imageformat==9 ) {
1917f8
 	big.height = getc(ttf);
1917f8
 	big.width = getc(ttf);
1917f8
diff -urN fontforge-20170731.old/fontforge/parsettf.c fontforge-20170731/fontforge/parsettf.c
1917f8
--- fontforge-20170731.old/fontforge/parsettf.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/parsettf.c	2018-09-23 14:50:31.566567564 +0530
1917f8
@@ -1972,7 +1972,8 @@
1917f8
 	    info->bad_glyph_data = true;
1917f8
 	    LogError( _("Bad tt font: contour ends make no sense in glyph %d.\n"),
1917f8
 		    sc->orig_pos );
1917f8
-return;
1917f8
+	    free(endpt);
1917f8
+	    return;
1917f8
 	}
1917f8
     }
1917f8
     if ( path_cnt==0 ) {
1917f8
diff -urN fontforge-20170731.old/fontforge/parsettfvar.c fontforge-20170731/fontforge/parsettfvar.c
1917f8
--- fontforge-20170731.old/fontforge/parsettfvar.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/parsettfvar.c	2018-09-23 14:50:31.567567549 +0530
1917f8
@@ -747,6 +747,7 @@
1917f8
 		ti = -1;
1917f8
 		if ( k!=info->variations->tuple_count )
1917f8
 		    ti = k;
1917f8
+		free(coords);
1917f8
 	    }
1917f8
 	    if ( ti!=-1 ) {
1917f8
 		here = ftell(ttf);
1917f8
diff -urN fontforge-20170731.old/fontforge/plugins.c fontforge-20170731/fontforge/plugins.c
1917f8
--- fontforge-20170731.old/fontforge/plugins.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/plugins.c	2018-09-23 14:50:31.567567549 +0530
1917f8
@@ -35,6 +35,7 @@
1917f8
 int LoadPlugin(const char *dynamic_lib_name) {
1917f8
     lt_dlhandle plugin;
1917f8
     plugin = load_plugin(dynamic_lib_name, LogError);
1917f8
+    free(plugin);
1917f8
     return (plugin != NULL);
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/print.c fontforge-20170731/fontforge/print.c
1917f8
--- fontforge-20170731.old/fontforge/print.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/print.c	2018-09-23 14:50:31.568567533 +0530
1917f8
@@ -2894,6 +2894,7 @@
1917f8
 	    }
1917f8
 	    if ( pt>start && i
1917f8
 		argv[i++] = start;
1917f8
+	    free(temp);
1917f8
 	}
1917f8
 	argv[i] = NULL;
1917f8
  /*for ( i=0; argv[i]!=NULL; ++i ) printf( "%s ", argv[i]); printf("\n" );*/
1917f8
diff -urN fontforge-20170731.old/fontforge/psread.c fontforge-20170731/fontforge/psread.c
1917f8
--- fontforge-20170731.old/fontforge/psread.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/psread.c	2018-09-23 14:50:31.569567518 +0530
1917f8
@@ -295,7 +295,9 @@
1917f8
 	wrapper->top = io->prev;
1917f8
 	if ( io->isstopped )
1917f8
 	    wrapper->endedstopped = true;
1917f8
-	if (io->start != NULL) free(io->start); io->start = NULL;
1917f8
+	if (io->start != NULL) 
1917f8
+		free(io->start); 
1917f8
+	io->start = NULL;
1917f8
 	free(io);
1917f8
 	io = wrapper->top;
1917f8
     }
1917f8
@@ -353,7 +355,9 @@
1917f8
     while ( io->prev!=NULL && !io->isstopped ) {
1917f8
 	iop = io->prev;
1917f8
 	wasloop = io->isloop;
1917f8
-	if (io->start != NULL) free(io->start); io->start = NULL;
1917f8
+	if (io->start != NULL) 
1917f8
+		free(io->start); 
1917f8
+	io->start = NULL;
1917f8
 	free(io);
1917f8
 	if ( wasloop ) {
1917f8
 	    wrapper->top = iop;
1917f8
@@ -377,7 +381,9 @@
1917f8
     while ( io->prev!=NULL ) {
1917f8
 	iop = io->prev;
1917f8
 	wasstopped = io->isstopped;
1917f8
-	if (io->start != NULL) free(io->start); io->start = NULL;
1917f8
+	if (io->start != NULL) 
1917f8
+		free(io->start); 
1917f8
+	io->start = NULL;
1917f8
 	free(io);
1917f8
 	if ( wasstopped ) {
1917f8
 	    wrapper->top = iop;
1917f8
@@ -2292,8 +2298,14 @@
1917f8
 		    int mx, mn;
1917f8
 		    real h, s, b;
1917f8
 		    mx = mn = r;
1917f8
-		    if ( mx>g ) mn=g; else mx=g;
1917f8
-		    if ( mx<bl ) mx = bl; if ( mn>bl ) mn = bl;
1917f8
+		    if ( mx>g ) 
1917f8
+			    mn=g; 
1917f8
+		    else 
1917f8
+			    mx=g;
1917f8
+		    if ( mx
1917f8
+			    mx = bl; 
1917f8
+		    if ( mn>bl ) 
1917f8
+			    mn = bl;
1917f8
 		    b = mx/255.;
1917f8
 		    s = h = 0;
1917f8
 		    if ( mx>0 )
1917f8
@@ -3364,8 +3376,10 @@
1917f8
 	    encname = copy(tokbuf);
1917f8
 	    tok = nextpstoken(&wrapper,&dval,tokbuf,sizeof(tokbuf));
1917f8
 	}
1917f8
-	if ( tok!=pt_openarray && tok!=pt_opencurly )
1917f8
+	if ( tok!=pt_openarray && tok!=pt_opencurly ){
1917f8
+		free(encname);
1917f8
 return( head );
1917f8
+    }
1917f8
 	for ( i=0; i
1917f8
 	    encs[i] = -1;
1917f8
 	    names[i]=NULL;
1917f8
@@ -4675,5 +4689,7 @@
1917f8
     HintsRenumber(ret);
1917f8
     if ( name!=NULL && strcmp(name,".notdef")!=0 )
1917f8
 	ret->widthset = true;
1917f8
+    free(pending_hm);
1917f8
+    free(pt);
1917f8
 return( ret );
1917f8
 }
1917f8
diff -urN fontforge-20170731.old/fontforge/python.c fontforge-20170731/fontforge/python.c
1917f8
--- fontforge-20170731.old/fontforge/python.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/python.c	2018-09-23 14:50:31.572567471 +0530
1917f8
@@ -1183,6 +1183,7 @@
1917f8
     tuple = PyTuple_New(cnt);
1917f8
     for ( i=0; i
1917f8
 	PyTuple_SetItem(tuple,i,Py_BuildValue("s",ret[i]));
1917f8
+    free(ret);
1917f8
 return( tuple );
1917f8
 }
1917f8
 
1917f8
@@ -1618,6 +1619,7 @@
1917f8
 	PyErr_Format(PyExc_ValueError, "Value out of bounds for 4th argument");
1917f8
 	free(title);
1917f8
 	free(quest);
1917f8
+	free(answers);
1917f8
 return( NULL );
1917f8
     }
1917f8
     for ( i=0; i
1917f8
@@ -2187,10 +2189,12 @@
1917f8
 	ss = SSFromContour(self,NULL);
1917f8
         if ( ss==NULL ) {
1917f8
             PyErr_SetString(PyExc_AttributeError, "Empty Contour");
1917f8
+	    free(ss);
1917f8
             return( NULL );
1917f8
         }
1917f8
 	self->spiros = SplineSet2SpiroCP(ss,&cnt);
1917f8
 	self->spiro_cnt = cnt;
1917f8
+	free(ss);
1917f8
     }
1917f8
     spirotuple = PyTuple_New(self->spiro_cnt-1);
1917f8
     for ( i=0; i<self->spiro_cnt-1; ++i ) {
1917f8
@@ -2893,7 +2897,10 @@
1917f8
     for ( i=0; i
1917f8
 	pos = PyInt_AsLong(PySequence_GetItem(args,i));
1917f8
 	if ( PyErr_Occurred())
1917f8
-return( NULL );
1917f8
+	{
1917f8
+		free(ss);
1917f8
+		return( NULL );
1917f8
+	}
1917f8
 	SSSelectOnCurve(ss,pos);
1917f8
     }
1917f8
     SplineCharMerge(NULL,&ss,1);
1917f8
@@ -2960,8 +2967,10 @@
1917f8
 	smpl.linefixup = PyFloat_AsDouble( PySequence_GetItem(args,3));
1917f8
     if ( !PyErr_Occurred() && PySequence_Size(args)>=5 )
1917f8
 	smpl.linelenmax = PyFloat_AsDouble( PySequence_GetItem(args,4));
1917f8
-    if ( PyErr_Occurred() )
1917f8
+    if ( PyErr_Occurred() ){
1917f8
+	    free(ss);
1917f8
 return( NULL );
1917f8
+    }
1917f8
     SplinePointListSimplify(NULL,ss,&smpl);
1917f8
     if ( ss==NULL ) {
1917f8
 	for ( i=0; i<self->pt_cnt; ++i )
1917f8
@@ -3292,6 +3301,7 @@
1917f8
 		do_pycall(pen,"qCurveTo",tuple);
1917f8
 	    } else {
1917f8
 		PyErr_Format(PyExc_TypeError, "Wrong number of off-curve points on a cubic contour");
1917f8
+		free(points);
1917f8
 return( NULL );
1917f8
 	    }
1917f8
 	    if ( PyErr_Occurred())
1917f8
@@ -3324,6 +3334,7 @@
1917f8
     if ( PyErr_Occurred())
1917f8
 return( NULL );
1917f8
 
1917f8
+free(points);
1917f8
 Py_RETURN( self );
1917f8
 }
1917f8
 
1917f8
@@ -3612,6 +3623,7 @@
1917f8
 	ss2 = SSFromLayer((PyFF_Layer *) other);
1917f8
     } else {
1917f8
 	PyErr_Format(PyExc_TypeError, "Unexpected type");
1917f8
+	free(ss);
1917f8
 return( -1 );
1917f8
     }
1917f8
     ret = SSsCompare(ss,ss2,pt_err,spline_err,&badpoint);
1917f8
@@ -3880,8 +3892,10 @@
1917f8
 	smpl.linefixup = PyFloat_AsDouble( PySequence_GetItem(args,3));
1917f8
     if ( !PyErr_Occurred() && PySequence_Size(args)>=5 )
1917f8
 	smpl.linelenmax = PyFloat_AsDouble( PySequence_GetItem(args,4));
1917f8
-    if ( PyErr_Occurred() )
1917f8
+    if ( PyErr_Occurred() ){
1917f8
+	    free(ss);
1917f8
 return( NULL );
1917f8
+    }
1917f8
     ss = SplineCharSimplify(NULL,ss,&smpl);
1917f8
     LayerFromSS(ss,self);
1917f8
     SplinePointListsFree(ss);
1917f8
@@ -4187,8 +4201,10 @@
1917f8
 	    SplinePointListsFree(ss);
1917f8
 	    ss = temp;
1917f8
 	}
1917f8
-	if ( !PolyCheck(ss))
1917f8
+	if ( !PolyCheck(ss)){
1917f8
+		free(ss);
1917f8
 return( -1 );
1917f8
+	}
1917f8
 	si->poly = ss;
1917f8
     } else if ( width<=0 || minor<=0 ) {
1917f8
         PyErr_Format(PyExc_ValueError, "Stroke width must be positive" );
1917f8
@@ -4765,7 +4781,9 @@
1917f8
 		    ++nexti;
1917f8
 		if ( c->points[nexti]->on_curve ) {
1917f8
 		    PyErr_Format(PyExc_TypeError, "In cubic splines there must be exactly 2 control points between on curve points");
1917f8
-return( NULL );
1917f8
+		    free(ss);
1917f8
+		    free(sp);
1917f8
+		    return( NULL );
1917f8
 		}
1917f8
 		if ( nexti==c->pt_cnt-1 )
1917f8
 		    nexti = 0;
1917f8
@@ -4773,7 +4791,9 @@
1917f8
 		    ++nexti;
1917f8
 		if ( !c->points[nexti]->on_curve ) {
1917f8
 		    PyErr_Format(PyExc_TypeError, "In cubic splines there must be exactly 2 control points between on curve points");
1917f8
-return( NULL );
1917f8
+		    free(sp);
1917f8
+		    free(ss);
1917f8
+		    return( NULL );
1917f8
 		}
1917f8
 	    }
1917f8
 	    if ( ss->last==NULL ) {
1917f8
@@ -4785,6 +4805,7 @@
1917f8
 	}
1917f8
 	if ( ss->last==NULL ) {
1917f8
 	    PyErr_Format(PyExc_TypeError, "Empty contour");
1917f8
+	    free(ss);
1917f8
 return( NULL );
1917f8
 	}
1917f8
     }
1917f8
@@ -6064,8 +6085,10 @@
1917f8
 	PyErr_Format(PyExc_TypeError, "Unexpected type");
1917f8
 return( -1 );
1917f8
     }
1917f8
-    if ( self->sc->layers[self->layer].refs!=NULL )
1917f8
+    if ( self->sc->layers[self->layer].refs!=NULL ){
1917f8
+	    free(ss2);
1917f8
 return( SS_NoMatch | SS_RefMismatch );
1917f8
+    }
1917f8
     ret = SSsCompare(self->sc->layers[self->layer].splines,ss2,pt_err,spline_err,&badpoint);
1917f8
     SplinePointListsFree(ss2);
1917f8
 return(ret);
1917f8
@@ -6274,8 +6297,10 @@
1917f8
 	    uni = 0; vs = -1; fid = 0;
1917f8
 	    if ( PyInt_Check(obj))
1917f8
 		uni = PyInt_AsLong(obj);
1917f8
-	    else if ( !PyArg_ParseTuple(obj,"i|ii", &uni, &vs, &fid))
1917f8
+	    else if ( !PyArg_ParseTuple(obj,"i|ii", &uni, &vs, &fid)){
1917f8
+		    free(head);
1917f8
 return( -1 );
1917f8
+	    }
1917f8
 	    cur = chunkalloc(sizeof(struct altuni));
1917f8
 	    if ( vs==0 ) vs=-1;		/* convention used in charinfo */
1917f8
 	    cur->unienc = uni; cur->vs = vs; cur->fid = fid;
1917f8
@@ -6738,7 +6763,10 @@
1917f8
 return( -1 );
1917f8
     for ( i=0; i
1917f8
 	if ( !PyArg_ParseTuple(PySequence_GetItem(value,i),"dd", &start, &width ))
1917f8
+	{
1917f8
+		free(tail);
1917f8
 return( -1 );
1917f8
+	}
1917f8
 	cur = chunkalloc(sizeof(StemInfo));
1917f8
 	if ( width==-20 || width==-21 )
1917f8
 	    cur->ghost = true;
1917f8
@@ -7036,8 +7064,10 @@
1917f8
 
1917f8
     for ( i=0; i
1917f8
 	ap = APFromTuple(sc,PySequence_GetItem(value,i));
1917f8
-	if ( ap==NULL )
1917f8
-return( -1 );
1917f8
+	if ( ap==NULL ){
1917f8
+		free(aplast);
1917f8
+		return( -1 );
1917f8
+	}
1917f8
 	if ( aphead==NULL )
1917f8
 	    aphead = ap;
1917f8
 	else
1917f8
@@ -7250,6 +7280,7 @@
1917f8
 	    self->sc->vert_variants = chunkalloc(sizeof(struct glyphvariants));
1917f8
 	self->sc->vert_variants->variants = copy(str);
1917f8
     }
1917f8
+    free(str);
1917f8
 return( 0 );
1917f8
 }
1917f8
 
1917f8
@@ -7276,6 +7307,7 @@
1917f8
 	    self->sc->horiz_variants = chunkalloc(sizeof(struct glyphvariants));
1917f8
 	self->sc->horiz_variants->variants = copy(str);
1917f8
     }
1917f8
+    free(str);
1917f8
 return( 0 );
1917f8
 }
1917f8
 
1917f8
@@ -7761,6 +7793,7 @@
1917f8
 
1917f8
     SCCharChangedUpdate(sc,((PyFF_Glyph *) self)->layer);
1917f8
 
1917f8
+    free(ap);
1917f8
 Py_RETURN( self );
1917f8
 }
1917f8
 
1917f8
@@ -8137,6 +8170,7 @@
1917f8
 	}
1917f8
         if ( deltalen==0 ) {
1917f8
 	    PyErr_Format(PyExc_TypeError,"Glyph name strings may not be empty");
1917f8
+	    free(str);
1917f8
             return( NULL );
1917f8
         }
1917f8
 	len += deltalen+1;
1917f8
@@ -8575,6 +8609,7 @@
1917f8
 	    old = NULL;
1917f8
 	} else {
1917f8
 	    PyErr_Format(PyExc_KeyError, "Unexpected lookup type: %s",sub->lookup->lookup_name);
1917f8
+	    free(other);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	temp.u.subs.variant = other;
1917f8
@@ -13659,6 +13694,7 @@
1917f8
 	ext = locfilename+len-2;
1917f8
 	if ( ext[0]!='p' || ext[1]!='k' ) {
1917f8
 	    PyErr_Format(PyExc_EnvironmentError, "No extension for bitmap font");
1917f8
+	    free(ext);
1917f8
 return( NULL );
1917f8
 	}
1917f8
     }
1917f8
@@ -13673,7 +13709,8 @@
1917f8
 	back = true;
1917f8
     } else {
1917f8
 	PyErr_Format(PyExc_EnvironmentError, "Bad extension for bitmap font");
1917f8
-return( NULL );
1917f8
+	free(ext);
1917f8
+	return( NULL );
1917f8
     }
1917f8
     if ( to_background!=-1 )
1917f8
 	back = to_background;
1917f8
@@ -13732,8 +13769,10 @@
1917f8
 	free(locfilename);
1917f8
 return( NULL );
1917f8
     }
1917f8
-    if ( CheckIfFontClosed(other) )
1917f8
+    if ( CheckIfFontClosed(other) ){
1917f8
+	    free(locfilename);
1917f8
 return (NULL);
1917f8
+    }
1917f8
     flags = FlagsFromTuple(flagstuple,compflags,"comparison flag");
1917f8
     if ( flags==FLAG_UNKNOWN ) {
1917f8
 	free(locfilename);
1917f8
@@ -14316,6 +14355,8 @@
1917f8
 	if ( offsets!=NULL ) {
1917f8
 	    if ( cnt1*cnt2 != PySequence_Size(offsets) ) {
1917f8
 		PyErr_Format(PyExc_ValueError, "There aren't enough kerning offsets for the number of kerning classes. Should be %d", cnt1*cnt2 );
1917f8
+		free(class1_strs);
1917f8
+		free(class2_strs);
1917f8
 return( NULL );
1917f8
 	    }
1917f8
 	    offs = malloc(cnt1*cnt2*sizeof(int16));
1917f8
@@ -14323,7 +14364,9 @@
1917f8
 		offs[i] = PyInt_AsLong(PySequence_GetItem(offsets,i));
1917f8
 		if ( PyErr_Occurred()) {
1917f8
                     free(offs);
1917f8
-return( NULL );
1917f8
+		    free(class1_strs);
1917f8
+		    free(class2_strs);
1917f8
+		    return( NULL );
1917f8
 }
1917f8
 	    }
1917f8
 	} else
1917f8
@@ -14333,6 +14376,8 @@
1917f8
     sub = addLookupSubtable(sf, lookup, subtable, after_str);
1917f8
     if ( sub==NULL ) {
1917f8
         free(offs);
1917f8
+	free(class1_strs);
1917f8
+	free(class2_strs);
1917f8
 return( NULL );
1917f8
     }
1917f8
     if ( sub->lookup->lookup_type!=gpos_pair ) {
1917f8
@@ -14407,6 +14452,8 @@
1917f8
     cnt2 = ParseClassNames(class2s,&class2_strs);
1917f8
     if ( cnt1*cnt2 != PySequence_Size(offsets) ) {
1917f8
 	PyErr_Format(PyExc_ValueError, "There aren't enough kerning offsets for the number of kerning classes. Should be %d", cnt1*cnt2 );
1917f8
+	free(class1_strs);
1917f8
+	free(class2_strs);
1917f8
 return( NULL );
1917f8
     }
1917f8
     offs = malloc(cnt1*cnt2*sizeof(int16));
1917f8
@@ -15266,6 +15313,7 @@
1917f8
 	mcnt = ParseClassNames(mclasses,&matchclasses);
1917f8
 	if ( mcnt==-1 ) {
1917f8
 	    PyErr_Format(PyExc_TypeError, "Bad match class" );
1917f8
+	    free(matchclasses);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	if ( mclassnames!=NULL ) {
1917f8
@@ -15305,6 +15353,7 @@
1917f8
     new_subtable = addLookupSubtable(sf, lookup, subtable, after_str);
1917f8
     if ( new_subtable==NULL ) {
1917f8
 	free(backclassnames); free(matchclasses); free(forclasses);
1917f8
+	free(matchclassnames);
1917f8
 return( NULL );
1917f8
     }
1917f8
     fpst = chunkalloc(sizeof(FPST));
1917f8
@@ -15495,6 +15544,7 @@
1917f8
 	rpl_ss = SSFromContour((PyFF_Contour *) rpl, NULL);
1917f8
     } else {
1917f8
 	PyErr_Format(PyExc_TypeError, "Expected a contour or layer");
1917f8
+    free(srch_ss);
1917f8
 return( NULL );
1917f8
     }
1917f8
 
1917f8
@@ -15939,11 +15989,13 @@
1917f8
 		last = cur;
1917f8
 	    } else {
1917f8
 		PyErr_Format(PyExc_TypeError, "Second argument must be either a font or a list of fonts");
1917f8
+		free(head);
1917f8
 return( NULL );
1917f8
 	    }
1917f8
 	}
1917f8
     } else {
1917f8
 	PyErr_Format(PyExc_TypeError, "Second argument must be either a font or a list of fonts");
1917f8
+	free(head);
1917f8
 return( NULL );
1917f8
     }
1917f8
 
1917f8
@@ -15982,6 +16034,7 @@
1917f8
 	otl = SFFindLookup(fv->sf,lookup_name);
1917f8
 	if ( otl == NULL ) {
1917f8
 	    PyErr_Format(PyExc_EnvironmentError, "No lookup named %s", lookup_name );
1917f8
+	    free(locfilename);
1917f8
 return( NULL );
1917f8
 	}
1917f8
     }
1917f8
@@ -16080,6 +16133,7 @@
1917f8
     if ( sf->fv==NULL )
1917f8
 	EncMapFree(sf->map);
1917f8
     newfv = SFAdd(InterpolateFont(fv->sf,sf,fraction, fv->map->enc ),false);
1917f8
+    free(sf);
1917f8
 return( PyFV_From_FV_I(newfv));
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/savefont.c fontforge-20170731/fontforge/savefont.c
1917f8
--- fontforge-20170731.old/fontforge/savefont.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/savefont.c	2018-09-23 14:50:31.573567455 +0530
1917f8
@@ -313,8 +313,10 @@
1917f8
     char *buf = malloc(strlen(filename)+12), *pt;
1917f8
     FILE *flog;
1917f8
 
1917f8
-    if ( sf->fontlog==NULL || *sf->fontlog=='\0' )
1917f8
-return( true );
1917f8
+    if ( sf->fontlog==NULL || *sf->fontlog=='\0' ) {
1917f8
+	    free(buf);
1917f8
+	    return( true );
1917f8
+	}
1917f8
 
1917f8
     strcpy(buf,filename);
1917f8
     pt = strrchr(buf,'/');
1917f8
diff -urN fontforge-20170731.old/fontforge/scstyles.c fontforge-20170731/fontforge/scstyles.c
1917f8
--- fontforge-20170731.old/fontforge/scstyles.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/scstyles.c	2018-09-23 14:50:31.575567424 +0530
1917f8
@@ -2578,7 +2578,8 @@
1917f8
     for ( j=0; j
1917f8
 	if ( overlaps[j].new_start == -10000 ) {
1917f8
 	    IError( "Hint zone not positioned" );
1917f8
-return;
1917f8
+	    free(overlaps);
1917f8
+	    return;
1917f8
 	}
1917f8
     }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/search.c fontforge-20170731/fontforge/search.c
1917f8
--- fontforge-20170731.old/fontforge/search.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/search.c	2018-09-23 14:50:31.575567424 +0530
1917f8
@@ -808,7 +808,8 @@
1917f8
     /* Total "fudge" amount should be spread evenly over each point */
1917f8
     FudgeFigure(s,path,&fudge);
1917f8
     if ( s->pointcnt!=s->rpointcnt )
1917f8
-	MinimumDistancesFree(sc->md); sc->md = NULL;
1917f8
+	MinimumDistancesFree(sc->md); 
1917f8
+    sc->md = NULL;
1917f8
 
1917f8
     sc_p = s->matched_sp; p_p = path->first, r_p = rpath->first;
1917f8
     if ( s->endpoints ) {
1917f8
diff -urN fontforge-20170731.old/fontforge/sfd.c fontforge-20170731/fontforge/sfd.c
1917f8
--- fontforge-20170731.old/fontforge/sfd.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/sfd.c	2018-09-23 14:50:31.576567408 +0530
1917f8
@@ -7924,10 +7924,14 @@
1917f8
     {
1917f8
     char* sname = SFDReadUTF7Str(sfd);
1917f8
     if (sf->pfminfo.stylemap == -1) {
1917f8
-        if (strcmp(sname,"bold italic")==0) sf->pfminfo.stylemap = 0x21;
1917f8
-        else if (strcmp(sname,"bold")==0) sf->pfminfo.stylemap = 0x20;
1917f8
-        else if (strcmp(sname,"italic")==0) sf->pfminfo.stylemap = 0x01;
1917f8
-        else if (strcmp(sname,"regular")==0) sf->pfminfo.stylemap = 0x40;
1917f8
+        if (strcmp(sname,"bold italic")==0) 
1917f8
+		sf->pfminfo.stylemap = 0x21;
1917f8
+        else if (strcmp(sname,"bold")==0) 
1917f8
+		sf->pfminfo.stylemap = 0x20;
1917f8
+        else if (strcmp(sname,"italic")==0) 
1917f8
+		sf->pfminfo.stylemap = 0x01;
1917f8
+        else if (strcmp(sname,"regular")==0) 
1917f8
+		sf->pfminfo.stylemap = 0x40;
1917f8
     }
1917f8
     free(sname);
1917f8
     }
1917f8
@@ -8010,7 +8014,8 @@
1917f8
 	{
1917f8
 	    /* Class 0 is unused */
1917f8
 	    int temp;
1917f8
-	    while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); ungetc(temp,sfd);
1917f8
+	    while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); 
1917f8
+	    ungetc(temp,sfd);
1917f8
 	    sf->mark_class_names[i] = SFDReadUTF7Str(sfd);
1917f8
 	    getint(sfd,&temp);
1917f8
 	    sf->mark_classes[i] = malloc(temp+1); sf->mark_classes[i][temp] = '\0';
1917f8
@@ -8027,10 +8032,12 @@
1917f8
 	{
1917f8
 	    /* Set 0 is used */
1917f8
 	    int temp;
1917f8
-	    while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); ungetc(temp,sfd);
1917f8
+	    while ( (temp=nlgetc(sfd))=='\n' || temp=='\r' ); 
1917f8
+	    ungetc(temp,sfd);
1917f8
 	    sf->mark_set_names[i] = SFDReadUTF7Str(sfd);
1917f8
 	    getint(sfd,&temp);
1917f8
-	    sf->mark_sets[i] = malloc(temp+1); sf->mark_sets[i][temp] = '\0';
1917f8
+	    sf->mark_sets[i] = malloc(temp+1); 
1917f8
+	    sf->mark_sets[i][temp] = '\0';
1917f8
 	    nlgetc(sfd);	/* skip space */
1917f8
 	    fread(sf->mark_sets[i],1,temp,sfd);
1917f8
 	}
1917f8
@@ -8042,7 +8049,8 @@
1917f8
 	int kernclassversion = 0;
1917f8
 	int isv = tok[0]=='V';
1917f8
 	int kcvoffset = (isv ? 10 : 9); //Offset to read kerning class version
1917f8
-	if (isdigit(tok[kcvoffset])) kernclassversion = tok[kcvoffset] - '0';
1917f8
+	if (isdigit(tok[kcvoffset])) 
1917f8
+		kernclassversion = tok[kcvoffset] - '0';
1917f8
 	int temp, classstart=1;
1917f8
 	int old = (kernclassversion == 0);
1917f8
 
1917f8
@@ -8088,35 +8096,51 @@
1917f8
 	for ( i=classstart; i<kc->first_cnt; ++i ) {
1917f8
 	  if (kernclassversion < 3) {
1917f8
 	    getint(sfd,&temp);
1917f8
-	    kc->firsts[i] = malloc(temp+1); kc->firsts[i][temp] = '\0';
1917f8
+	    kc->firsts[i] = malloc(temp+1); 
1917f8
+	    kc->firsts[i][temp] = '\0';
1917f8
 	    nlgetc(sfd);	/* skip space */
1917f8
 	    fread(kc->firsts[i],1,temp,sfd);
1917f8
 	  } else {
1917f8
 	    getint(sfd,&kc->firsts_flags[i]);
1917f8
-	    while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue;
1917f8
+	    while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	    ungetc(ch, sfd); 
1917f8
+	    if (ch == '\n' || ch == EOF) 
1917f8
+		    continue;
1917f8
 	    kc->firsts_names[i] = SFDReadUTF7Str(sfd);
1917f8
-	    while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue;
1917f8
+	    while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	    ungetc(ch, sfd); 
1917f8
+	    if (ch == '\n' || ch == EOF) 
1917f8
+		    continue;
1917f8
 	    kc->firsts[i] = SFDReadUTF7Str(sfd);
1917f8
             if (kc->firsts[i] == NULL) kc->firsts[i] = copy(""); // In certain places, this must be defined.
1917f8
-	    while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd);
1917f8
+	    while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); 
1917f8
+	    ungetc(ch, sfd);
1917f8
 	  }
1917f8
 	}
1917f8
 	kc->seconds[0] = NULL;
1917f8
 	for ( i=1; i<kc->second_cnt; ++i ) {
1917f8
 	  if (kernclassversion < 3) {
1917f8
 	    getint(sfd,&temp);
1917f8
-	    kc->seconds[i] = malloc(temp+1); kc->seconds[i][temp] = '\0';
1917f8
+	    kc->seconds[i] = malloc(temp+1); 
1917f8
+	    kc->seconds[i][temp] = '\0';
1917f8
 	    nlgetc(sfd);	/* skip space */
1917f8
 	    fread(kc->seconds[i],1,temp,sfd);
1917f8
 	  } else {
1917f8
 	    getint(sfd,&temp);
1917f8
 	    kc->seconds_flags[i] = temp;
1917f8
-	    while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue;
1917f8
+	    while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	    ungetc(ch, sfd); 
1917f8
+	    if (ch == '\n' || ch == EOF) 
1917f8
+		    continue;
1917f8
 	    kc->seconds_names[i] = SFDReadUTF7Str(sfd);
1917f8
-	    while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd); if (ch == '\n' || ch == EOF) continue;
1917f8
+	    while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	    ungetc(ch, sfd); 
1917f8
+	    if (ch == '\n' || ch == EOF) 
1917f8
+		    continue;
1917f8
 	    kc->seconds[i] = SFDReadUTF7Str(sfd);
1917f8
             if (kc->seconds[i] == NULL) kc->seconds[i] = copy(""); // In certain places, this must be defined.
1917f8
-	    while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd);
1917f8
+	    while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); 
1917f8
+	    ungetc(ch, sfd);
1917f8
 	  }
1917f8
 	}
1917f8
 	for ( i=0; i<kc->first_cnt*kc->second_cnt; ++i ) {
1917f8
@@ -8173,39 +8197,50 @@
1917f8
     }
1917f8
     else if ( strmatch(tok,"Group:")==0 ) {
1917f8
         struct ff_glyphclasses *grouptmp = calloc(1, sizeof(struct ff_glyphclasses));
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         grouptmp->classname = SFDReadUTF7Str(sfd);
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         grouptmp->glyphs = SFDReadUTF7Str(sfd);
1917f8
-        while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); 
1917f8
+	ungetc(ch, sfd);
1917f8
         if (d->lastgroup != NULL) d->lastgroup->next = grouptmp; else sf->groups = grouptmp;
1917f8
         d->lastgroup = grouptmp;
1917f8
     }
1917f8
     else if ( strmatch(tok,"GroupKern:")==0 ) {
1917f8
         int temp = 0;
1917f8
         struct ff_rawoffsets *kerntmp = calloc(1, sizeof(struct ff_rawoffsets));
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         kerntmp->left = SFDReadUTF7Str(sfd);
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         kerntmp->right = SFDReadUTF7Str(sfd);
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         getint(sfd,&temp);
1917f8
         kerntmp->offset = temp;
1917f8
-        while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); 
1917f8
+	ungetc(ch, sfd);
1917f8
         if (d->lastgroupkern != NULL) d->lastgroupkern->next = kerntmp; else sf->groupkerns = kerntmp;
1917f8
         d->lastgroupkern = kerntmp;
1917f8
     }
1917f8
     else if ( strmatch(tok,"GroupVKern:")==0 ) {
1917f8
         int temp = 0;
1917f8
         struct ff_rawoffsets *kerntmp = calloc(1, sizeof(struct ff_rawoffsets));
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         kerntmp->left = SFDReadUTF7Str(sfd);
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         kerntmp->right = SFDReadUTF7Str(sfd);
1917f8
-        while ((ch=nlgetc(sfd)) == ' '); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' '); 
1917f8
+	ungetc(ch, sfd);
1917f8
         getint(sfd,&temp);
1917f8
         kerntmp->offset = temp;
1917f8
-        while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); ungetc(ch, sfd);
1917f8
+        while ((ch=nlgetc(sfd)) == ' ' || ch == '\n'); 
1917f8
+	ungetc(ch, sfd);
1917f8
         if (d->lastgroupvkern != NULL) d->lastgroupvkern->next = kerntmp; else sf->groupvkerns = kerntmp;
1917f8
         d->lastgroupvkern = kerntmp;
1917f8
     }
1917f8
@@ -8710,6 +8746,7 @@
1917f8
 	    else if ( lastnamedinstance !=NULL )
1917f8
 		lastnamedinstance->names = names;
1917f8
 	    pushedbacktok = true;
1917f8
+	    free(names);
1917f8
 	} else if ( strmatch(tok,"MMCDV:")==0 ) {
1917f8
 	    MMSet *mm = sf->mm;
1917f8
 	    if ( mm!=NULL )
1917f8
@@ -8833,6 +8870,7 @@
1917f8
     if (sf->map == NULL) sf->map = EncMapNew(sf->glyphcnt,sf->glyphcnt,&custom);
1917f8
 
1917f8
     SFDFixupUndoRefs(sf);
1917f8
+    free(remap);
1917f8
 return( sf );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/sflayout.c fontforge-20170731/fontforge/sflayout.c
1917f8
--- fontforge-20170731.old/fontforge/sflayout.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/sflayout.c	2018-09-23 14:50:31.576567408 +0530
1917f8
@@ -1285,6 +1285,7 @@
1917f8
     LayoutInfo_Destroy(li);
1917f8
     if ( freeme!=NULL )
1917f8
 	arrayfree(freeme);
1917f8
+    free(li);
1917f8
 }
1917f8
 
1917f8
 #include <stdlib.h>
1917f8
@@ -1415,5 +1416,6 @@
1917f8
     }
1917f8
 
1917f8
     LI_MetaChangeCleanup(li,start,end,width);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
diff -urN fontforge-20170731.old/fontforge/splinefont.c fontforge-20170731/fontforge/splinefont.c
1917f8
--- fontforge-20170731.old/fontforge/splinefont.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/splinefont.c	2018-09-23 14:50:31.577567393 +0530
1917f8
@@ -999,8 +999,10 @@
1917f8
 		    unlink(spuriousname); free(spuriousname);
1917f8
 		} else
1917f8
 		    strippedname = Unarchive(strippedname,&archivedir);
1917f8
-		if ( strippedname==NULL )
1917f8
-            return NULL;
1917f8
+		if ( strippedname==NULL ){
1917f8
+			free(archivedir);
1917f8
+            		return NULL;
1917f8
+		}
1917f8
 		if ( strippedname!=fname && paren!=NULL ) {
1917f8
 		    fullname = malloc(strlen(strippedname)+strlen(paren)+1);
1917f8
 		    strcpy(fullname,strippedname);
1917f8
@@ -1160,7 +1162,8 @@
1917f8
 	    checked = 'i';
1917f8
 	    sf = SFReadIkarus(fullname);
1917f8
 	} /* Too hard to figure out a valid mark for a mac resource file */
1917f8
-	if ( file!=NULL ) fclose(file);
1917f8
+	if ( file!=NULL ) 
1917f8
+		fclose(file);
1917f8
     }
1917f8
 
1917f8
     if ( sf!=NULL )
1917f8
@@ -1280,7 +1283,9 @@
1917f8
                 sf = NULL;
1917f8
 	    }
1917f8
     }
1917f8
-    if (fname != NULL && fname != filename) free(fname); fname = NULL;
1917f8
+    if (fname != NULL && fname != filename) 
1917f8
+	    free(fname); 
1917f8
+    fname = NULL;
1917f8
     return sf;
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/splineoverlap.c fontforge-20170731/fontforge/splineoverlap.c
1917f8
--- fontforge-20170731.old/fontforge/splineoverlap.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/splineoverlap.c	2018-09-23 14:50:31.577567393 +0530
1917f8
@@ -494,6 +494,7 @@
1917f8
     }
1917f8
     current_pointer = &((*current_pointer)->next);
1917f8
   }
1917f8
+  free(tmp_pointer);
1917f8
   return;
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/splinesaveafm.c fontforge-20170731/fontforge/splinesaveafm.c
1917f8
--- fontforge-20170731.old/fontforge/splinesaveafm.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/splinesaveafm.c	2018-09-23 14:55:32.054958121 +0530
1917f8
@@ -1285,8 +1285,10 @@
1917f8
 	    ch = start[4]; start[4] = '\0';
1917f8
 	    unicode[u++] = strtol(start,&end,16);
1917f8
 	    start[4] = ch;
1917f8
-	    if ( *end!='\0' )
1917f8
-return( -1 );
1917f8
+	    if ( *end!='\0' ){
1917f8
+		    free(start);
1917f8
+		return( -1 );
1917f8
+	    }
1917f8
 	    start += 4;
1917f8
 	}
1917f8
 return( u );
1917f8
@@ -3424,6 +3426,7 @@
1917f8
 	free( italicindex );
1917f8
     } else
1917f8
 	free( lkarray );
1917f8
+    free(kerns);
1917f8
 return( !ferror(tfm));
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/splinestroke.c fontforge-20170731/fontforge/splinestroke.c
1917f8
--- fontforge-20170731.old/fontforge/splinestroke.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/splinestroke.c	2018-09-23 14:50:31.578567377 +0530
1917f8
@@ -3847,6 +3847,7 @@
1917f8
 		c.resolution = c.radius/3;
1917f8
         if (c.resolution == 0) {
1917f8
             ff_post_notice(_("Invalid stroke parameters"), _("Stroke resolution is zero"));
1917f8
+	    free(first);
1917f8
             return SplinePointListCopy(ss);
1917f8
         }
1917f8
 	    cur = SplineSets_Stroke(ss,&c,order2);
1917f8
diff -urN fontforge-20170731.old/fontforge/splineutil.c fontforge-20170731/fontforge/splineutil.c
1917f8
--- fontforge-20170731.old/fontforge/splineutil.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/splineutil.c	2018-09-23 14:50:31.579567361 +0530
1917f8
@@ -224,7 +224,8 @@
1917f8
 	    next = spline->to->next; // Cache the location of the next spline.
1917f8
 	    SplinePointFree(spline->to); // Free the destination point.
1917f8
 	    SplineFree(spline); // Free the spline.
1917f8
-	    if ( first==NULL ) first = spline; // We want to avoid repeating the circuit.
1917f8
+	    if ( first==NULL ) 
1917f8
+		    first = spline; // We want to avoid repeating the circuit.
1917f8
 	}
1917f8
         // If the path is open or has no splines, free the starting point.
1917f8
 	if ( spl->last!=spl->first || nonext )
1917f8
@@ -262,7 +263,8 @@
1917f8
 	    next = spline->to->next;
1917f8
 	    SplinePointMDFree(sc,spline->to);
1917f8
 	    SplineFree(spline);
1917f8
-	    if ( first==NULL ) first = spline;
1917f8
+	    if ( first==NULL ) 
1917f8
+		    first = spline;
1917f8
 	}
1917f8
 	if ( freefirst )
1917f8
 	    SplinePointMDFree(sc,spl->first);
1917f8
@@ -1404,7 +1406,8 @@
1917f8
 	last = cur;
1917f8
 	i = j;
1917f8
     }
1917f8
-return( head );
1917f8
+    free(list);
1917f8
+    return( head );
1917f8
 }
1917f8
 
1917f8
 SplinePointList *SplinePointListCopy(const SplinePointList *base) {
1917f8
diff -urN fontforge-20170731.old/fontforge/strlist.c fontforge-20170731/fontforge/strlist.c
1917f8
--- fontforge-20170731.old/fontforge/strlist.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/strlist.c	2018-09-23 14:50:31.579567361 +0530
1917f8
@@ -34,6 +34,7 @@
1917f8
 	list->next = NULL;
1917f8
 	list->str = str2;
1917f8
     }
1917f8
+    free(str2);
1917f8
     return list;
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/svg.c fontforge-20170731/fontforge/svg.c
1917f8
--- fontforge-20170731.old/fontforge/svg.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/svg.c	2018-09-23 14:50:31.580567346 +0530
1917f8
@@ -2634,8 +2634,11 @@
1917f8
     if ( name!=NULL ) {
1917f8
 	int hide = xmlStrcmp(name,(xmlChar *) "none")==0;
1917f8
 	xmlFree(name);
1917f8
-	if ( hide )
1917f8
-return( NULL );
1917f8
+	if ( hide ){
1917f8
+		free(fill_colour_source);
1917f8
+		free(stroke_colour_source);
1917f8
+	return( NULL );	
1917f8
+	}
1917f8
     }
1917f8
     name = xmlGetProp(svg,(xmlChar *) "visibility");
1917f8
     if ( name!=NULL ) {
1917f8
@@ -2772,7 +2775,9 @@
1917f8
 
1917f8
     if ( !st.isvisible ) {
1917f8
 	SvgStateFree(&st);
1917f8
-return( NULL );
1917f8
+	free(fill_colour_source);
1917f8
+	free(stroke_colour_source);
1917f8
+	return( NULL );
1917f8
     }
1917f8
 
1917f8
     /* basic shapes */
1917f8
@@ -2798,8 +2803,11 @@
1917f8
 return( eret );
1917f8
     } else
1917f8
 return( NULL );
1917f8
-    if ( head==NULL )
1917f8
-return( NULL );
1917f8
+    if ( head==NULL ){
1917f8
+	    free(fill_colour_source);
1917f8
+	    free(stroke_colour_source);
1917f8
+	return( NULL );
1917f8
+    }
1917f8
 
1917f8
     SPLCategorizePoints(head);
1917f8
 
1917f8
@@ -3056,6 +3064,7 @@
1917f8
 	}
1917f8
 	free(u);
1917f8
     }
1917f8
+    free(chars);
1917f8
 }
1917f8
 
1917f8
 static char *SVGGetNames(SplineFont *sf,xmlChar *g,xmlChar *utf8,SplineChar **sc) {
1917f8
diff -urN fontforge-20170731.old/fontforge/tottfaat.c fontforge-20170731/fontforge/tottfaat.c
1917f8
--- fontforge-20170731.old/fontforge/tottfaat.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/tottfaat.c	2018-09-23 14:50:31.580567346 +0530
1917f8
@@ -1483,6 +1483,7 @@
1917f8
 	}
1917f8
 	free(scripts);
1917f8
     }
1917f8
+    free(sm);
1917f8
 return( features );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforge/tottf.c fontforge-20170731/fontforge/tottf.c
1917f8
--- fontforge-20170731.old/fontforge/tottf.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/tottf.c	2018-09-23 14:50:31.581567330 +0530
1917f8
@@ -4394,8 +4394,10 @@
1917f8
 		(subheadcnt-i)*sizeof(struct subhead) + sizeof(uint16);
1917f8
 
1917f8
     sub = tmpfile();
1917f8
-    if ( sub==NULL )
1917f8
-return( NULL );
1917f8
+    if ( sub==NULL ){
1917f8
+	free(glyphs);
1917f8
+	return( NULL );
1917f8
+	}
1917f8
 
1917f8
     putshort(sub,2);		/* 8/16 format */
1917f8
     putshort(sub,0);		/* Subtable length, we'll come back and fix this */
1917f8
diff -urN fontforge-20170731.old/fontforge/tottfgpos.c fontforge-20170731/fontforge/tottfgpos.c
1917f8
--- fontforge-20170731.old/fontforge/tottfgpos.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/tottfgpos.c	2018-09-23 14:54:53.300546119 +0530
1917f8
@@ -452,8 +452,10 @@
1917f8
 		++cnt;
1917f8
 	    }
1917f8
 	}
1917f8
-	if ( cnt==0 )
1917f8
-return( NULL );
1917f8
+	if ( cnt==0 ){
1917f8
+		free(array);
1917f8
+		return( NULL );
1917f8
+	}
1917f8
 	if ( j==1 )
1917f8
     break;
1917f8
 	array = malloc((cnt+1)*sizeof(SplineChar *));
1917f8
@@ -583,13 +585,14 @@
1917f8
 	// And we null-terminate.
1917f8
 	glyphs[i] = NULL;
1917f8
     }
1917f8
-    for ( i=0; i
1917f8
+    for ( i=0; i
1917f8
         if (glyphs[i]->ttf_glyph==glyphs[i+1]->ttf_glyph) {
1917f8
 						// fprintf(stderr, "Duplicate glyph.\n");
1917f8
             memmove(glyphs+i, glyphs+i+1, (cnt-i)*sizeof(SplineChar *));
1917f8
             --cnt;
1917f8
         }
1917f8
-	glyphs[cnt] = NULL;
1917f8
+    }
1917f8
+    glyphs[cnt] = NULL;
1917f8
 return( glyphs );
1917f8
 }
1917f8
 
1917f8
@@ -3476,8 +3479,10 @@
1917f8
 	glyphs = malloc((lcnt+1)*sizeof(SplineChar *));
1917f8
 	glyphs[lcnt] = NULL;
1917f8
     }
1917f8
-    if ( !needsclass && lcnt==0 && sf->mark_class_cnt==0 && sf->mark_set_cnt==0 )
1917f8
-return;					/* No anchor positioning, no ligature carets */
1917f8
+    if ( !needsclass && lcnt==0 && sf->mark_class_cnt==0 && sf->mark_set_cnt==0 ){
1917f8
+	    free(glyphs);
1917f8
+	return;					/* No anchor positioning, no ligature carets */
1917f8
+    }
1917f8
 
1917f8
     at->gdef = tmpfile();
1917f8
     if ( sf->mark_set_cnt==0 ) {
1917f8
diff -urN fontforge-20170731.old/fontforge/ttfinstrs.c fontforge-20170731/fontforge/ttfinstrs.c
1917f8
--- fontforge-20170731.old/fontforge/ttfinstrs.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/ttfinstrs.c	2018-09-23 14:50:31.582567314 +0530
1917f8
@@ -309,7 +309,8 @@
1917f8
 		val = strtol(pt,&end,0);
1917f8
 		if ( val>32767 || val<-32768 ) {
1917f8
 		    IVError(iv,_("A value must be between [-32768,32767]"),pt-text);
1917f8
-return( NULL );
1917f8
+		    free(instrs);
1917f8
+		    return( NULL );
1917f8
 		}
1917f8
 
1917f8
 		pt = end;
1917f8
@@ -317,14 +318,16 @@
1917f8
 		if ( *pt == '@' ) { /* a delta control byte */
1917f8
 		    if ( val>8 || val<-8 || val==0 ) {
1917f8
 			IVError(iv,_("A value must be between [-8,-1] or [1,8]"),pt-text);
1917f8
-return( NULL );
1917f8
+			free(instrs);
1917f8
+			return( NULL );
1917f8
 		    }
1917f8
 
1917f8
 		    pt++;
1917f8
 
1917f8
 		    if ( !isdigit( *pt ) ) {
1917f8
 			IVError(iv,_("Number expected"),pt-text);
1917f8
-return( NULL );
1917f8
+			free(instrs);
1917f8
+			return( NULL );
1917f8
 		    }
1917f8
 
1917f8
 		    temp = val;
1917f8
@@ -332,7 +335,8 @@
1917f8
 
1917f8
 		    if ( val>15 || val<0 ) {
1917f8
 			IVError(iv,_("A value must be between [0,15]"),pt-text);
1917f8
-return( NULL );
1917f8
+			free(instrs);
1917f8
+		        return( NULL );
1917f8
 		    }
1917f8
 
1917f8
 		    val *= 16;
1917f8
@@ -348,14 +352,16 @@
1917f8
 		while ( *pt==' ' || *pt=='\t' ) ++pt;
1917f8
 		if ( *pt!='(' ) {
1917f8
 		    IVError(iv,_("Missing left parenthesis in command to get a cvt index"),pt-text);
1917f8
-return( NULL );
1917f8
+		    free(instrs);
1917f8
+		    return( NULL );
1917f8
 		}
1917f8
 		temp = strtol(pt+1,&end,0);
1917f8
 		pt = end;
1917f8
 		while ( *pt==' ' || *pt=='\t' ) ++pt;
1917f8
 		if ( *pt!=')' ) {
1917f8
 		    IVError(iv,_("Missing right paren in command to get a cvt index"),pt-text);
1917f8
-return( NULL );
1917f8
+		    free(instrs);
1917f8
+		    return( NULL );
1917f8
 		}
1917f8
 		numberstack[npos++] = TTF__getcvtval(sf,temp);
1917f8
 		++pt;
1917f8
@@ -396,7 +402,8 @@
1917f8
 	}
1917f8
 	if ( nread
1917f8
 	    IVError(iv,_("Unexpected number"),pt-text);
1917f8
-return( NULL );
1917f8
+	    free(instrs);
1917f8
+	    return( NULL );
1917f8
 	}
1917f8
 	if ( *pt=='\r' || *pt=='\n' || *pt=='\0' )
1917f8
     continue;
1917f8
@@ -446,11 +453,13 @@
1917f8
 	    while ( *bend==' ' || *bend=='\t' ) ++bend;
1917f8
 	    if ( *bend!=']' ) {
1917f8
 		IVError(iv,_("Missing right bracket in command (or bad binary value in bracket)"),pt-text);
1917f8
-return( NULL );
1917f8
+		free(instrs);
1917f8
+		return( NULL );
1917f8
 	    }
1917f8
 	    if ( val>=32 ) {
1917f8
 		IVError(iv,_("Bracketted value is too large"),pt-text);
1917f8
-return( NULL );
1917f8
+		free(instrs);
1917f8
+		return( NULL );
1917f8
 	    }
1917f8
 	    i += val;
1917f8
 	}
1917f8
diff -urN fontforge-20170731.old/fontforge/ttfspecial.c fontforge-20170731/fontforge/ttfspecial.c
1917f8
--- fontforge-20170731.old/fontforge/ttfspecial.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/ttfspecial.c	2018-09-23 14:54:21.159033774 +0530
1917f8
@@ -1356,6 +1356,7 @@
1917f8
 	}
1917f8
     }
1917f8
     free(contours);
1917f8
+    free(cur);
1917f8
 }
1917f8
 
1917f8
 static void pfed_readguidelines(FILE *ttf,struct ttfinfo *info,uint32 base) {
1917f8
diff -urN fontforge-20170731.old/fontforge/ufo.c fontforge-20170731/fontforge/ufo.c
1917f8
--- fontforge-20170731.old/fontforge/ufo.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforge/ufo.c	2018-09-23 14:50:31.583567299 +0530
1917f8
@@ -2513,7 +2513,18 @@
1917f8
 				}
1917f8
 				lastref = r;
1917f8
 		    }
1917f8
-		    if (xs) free(xs); if (ys) free(ys); if (xys) free(xys); if (yxs) free(yxs); if (xo) free(xo); if (yo) free(yo);
1917f8
+		    if (xs) 
1917f8
+			    free(xs); 
1917f8
+		    if (ys) 
1917f8
+			    free(ys); 
1917f8
+		    if (xys) 
1917f8
+			    free(xys); 
1917f8
+		    if (yxs) 
1917f8
+			    free(yxs); 
1917f8
+		    if (xo) 
1917f8
+			    free(xo); 
1917f8
+		    if (yo) 
1917f8
+			    free(yo);
1917f8
 		} else if ( xmlStrcmp(contour->name,(const xmlChar *) "contour")==0 ) {
1917f8
 		    xmlNodePtr npoints;
1917f8
 
1917f8
@@ -4065,12 +4076,12 @@
1917f8
 	    strncmp(sf->names->names[ttf_version],"Version ",8)==0 )
1917f8
 	sf->version = copy(sf->names->names[ttf_version]+8);
1917f8
 
1917f8
-	char * layercontentsname = buildname(basedir,"layercontents.plist");
1917f8
-	char ** layernames = NULL;
1917f8
-	if (layercontentsname == NULL) {
1917f8
+    char * layercontentsname = buildname(basedir,"layercontents.plist");
1917f8
+    char ** layernames = NULL;
1917f8
+    if (layercontentsname == NULL) {
1917f8
 		switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale.
1917f8
 		return( NULL );
1917f8
-	} else if ( GFileExists(layercontentsname)) {
1917f8
+    } else if ( GFileExists(layercontentsname)) {
1917f8
 		xmlDocPtr layercontentsdoc = NULL;
1917f8
 		xmlNodePtr layercontentsplist = NULL;
1917f8
 		xmlNodePtr layercontentsdict = NULL;
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/alignment.c fontforge-20170731/fontforgeexe/alignment.c
1917f8
--- fontforge-20170731.old/fontforgeexe/alignment.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/alignment.c	2018-09-23 14:50:31.583567299 +0530
1917f8
@@ -126,8 +126,10 @@
1917f8
     }
1917f8
 
1917f8
     /* we need at least three regions to space things out */
1917f8
-    if ( rcnt<3 )
1917f8
+    if ( rcnt<3 ){
1917f8
+	    free(regions);
1917f8
 return;
1917f8
+    }
1917f8
 
1917f8
     /* Now should I allow equal spaces between regions, or spaces between */
1917f8
     /*  region mid-points? I think spaces between regions */
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/charinfo.c fontforge-20170731/fontforgeexe/charinfo.c
1917f8
--- fontforge-20170731.old/fontforgeexe/charinfo.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/charinfo.c	2018-09-23 14:50:31.584567283 +0530
1917f8
@@ -3008,6 +3008,7 @@
1917f8
 	    for ( j=0; j
1917f8
 		BDFCharFree(others[j]);
1917f8
 	    free(others);
1917f8
+	    free(me);
1917f8
 return( NULL );
1917f8
 	}
1917f8
 	others[i] = Rasterize(othersc,def_layer);
1917f8
@@ -3263,6 +3264,7 @@
1917f8
         for ( i=0; i
1917f8
             BDFCharFree(extras[i]);
1917f8
         free(extras);
1917f8
+	free(me);
1917f8
         return( NULL );
1917f8
     }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/charview.c fontforge-20170731/fontforgeexe/charview.c
1917f8
--- fontforge-20170731.old/fontforgeexe/charview.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/charview.c	2018-09-23 14:50:31.585567268 +0530
1917f8
@@ -4437,7 +4437,10 @@
1917f8
     sign = dx*dy<0?-1:1;
1917f8
 
1917f8
     fake->u.mouse = event->u.mouse;
1917f8
-    if ( dx<0 ) dx = -dx; if ( dy<0 ) dy = -dy;
1917f8
+    if ( dx<0 ) 
1917f8
+	    dx = -dx; 
1917f8
+    if ( dy<0 ) 
1917f8
+	    dy = -dy;
1917f8
     if ( dy >= 2*dx ) {
1917f8
 	cv->p.x = fake->u.mouse.x = basex;
1917f8
 	cv->p.cx = basetruex ;
1917f8
@@ -4726,6 +4729,7 @@
1917f8
 	{
1917f8
 	    GGadgetSetTitle( cv->charselector, p );
1917f8
 	}
1917f8
+	free(srctxt);
1917f8
     }
1917f8
     
1917f8
     
1917f8
@@ -5328,7 +5332,10 @@
1917f8
 	    int sign = dx*dy<0?-1:1;
1917f8
 	    double aspect = 1.0;
1917f8
 
1917f8
-	    if ( dx<0 ) dx = -dx; if ( dy<0 ) dy = -dy;
1917f8
+	    if ( dx<0 ) 
1917f8
+		    dx = -dx; 
1917f8
+	    if ( dy<0 ) 
1917f8
+		    dy = -dy;
1917f8
 	    if ( cv->p.img!=NULL && cv->p.img->bb.minx!=cv->p.img->bb.maxx )
1917f8
 		aspect = (cv->p.img->bb.maxy - cv->p.img->bb.miny) / (cv->p.img->bb.maxx - cv->p.img->bb.minx);
1917f8
 	    else if ( cv->p.ref!=NULL && cv->p.ref->bb.minx!=cv->p.ref->bb.maxx )
1917f8
@@ -7487,8 +7494,10 @@
1917f8
             e.u.control.subtype = et_textchanged;
1917f8
             e.u.control.u.tf_changed.from_pulldown = 0;
1917f8
             CV_OnCharSelectorTextChanged( cv->charselector, &e );
1917f8
+	    free(txt);
1917f8
             return;
1917f8
         }
1917f8
+	free(txt);
1917f8
     }
1917f8
     
1917f8
     if ( mid == MID_Next ) {
1917f8
@@ -12810,6 +12819,7 @@
1917f8
 		    }
1917f8
 		}
1917f8
 	    }
1917f8
+	free(wll);
1917f8
 	}
1917f8
 	free(txt);
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/contextchain.c fontforge-20170731/fontforgeexe/contextchain.c
1917f8
--- fontforge-20170731.old/fontforgeexe/contextchain.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/contextchain.c	2018-09-23 14:50:31.586567252 +0530
1917f8
@@ -641,6 +641,7 @@
1917f8
 	    (&r->u.class.nclasses)[which] = malloc(any*sizeof(uint16));
1917f8
 	}
1917f8
     }
1917f8
+    free(pt);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/cvgetinfo.c fontforge-20170731/fontforgeexe/cvgetinfo.c
1917f8
--- fontforge-20170731.old/fontforgeexe/cvgetinfo.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/cvgetinfo.c	2018-09-23 14:50:31.586567252 +0530
1917f8
@@ -1059,6 +1059,7 @@
1917f8
     ti = AnchorClassesLList(sf),false);
1917f8
     for ( j=0; ti[j]->text!=NULL && ti[j]->userdata!=ac; ++j )
1917f8
         GGadgetSelectOneListItem(GWidgetGetControl(ci->gw,CID_NameList),j);
1917f8
+    free(name);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -3903,8 +3904,11 @@
1917f8
 	    }
1917f8
 	    ++k;
1917f8
 	} while ( k<_sf->subfontcnt );
1917f8
-	if ( tot==0 )
1917f8
+	if ( tot==0 ){
1917f8
+		free(deps);
1917f8
+		free(depsc);
1917f8
 return;
1917f8
+	}
1917f8
 	if ( j==0 ) {
1917f8
 	    deps = calloc(tot+1,sizeof(char *));
1917f8
 	    depsc = malloc(tot*sizeof(SplineChar *));
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/cvimportdlg.c fontforge-20170731/fontforgeexe/cvimportdlg.c
1917f8
--- fontforge-20170731.old/fontforgeexe/cvimportdlg.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/cvimportdlg.c	2018-09-23 14:50:31.587567236 +0530
1917f8
@@ -427,8 +427,10 @@
1917f8
 	GGadget *tf;
1917f8
 
1917f8
 	GFileChooserGetChildren(d->gfc,NULL,NULL,&tf);
1917f8
-	if ( *_GGadgetGetTitle(tf)=='\0' )
1917f8
+	if ( *_GGadgetGetTitle(tf)=='\0' ){
1917f8
+		free(temp);
1917f8
 return( true );
1917f8
+	}
1917f8
 	GDrawSetCursor(GGadgetGetWindow(g),ct_watch);
1917f8
 	if ( d->fv!=NULL )
1917f8
 	    flast_format = pos;
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/cvpalettes.c fontforge-20170731/fontforgeexe/cvpalettes.c
1917f8
--- fontforge-20170731.old/fontforgeexe/cvpalettes.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/cvpalettes.c	2018-09-23 14:50:31.587567236 +0530
1917f8
@@ -2432,6 +2432,7 @@
1917f8
 
1917f8
 	layerinfo.rename_active = 0;
1917f8
 	CVInfoDrawText(cv,cv->gw);
1917f8
+	free(str);
1917f8
     }
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/displayfonts.c fontforge-20170731/fontforgeexe/displayfonts.c
1917f8
--- fontforge-20170731.old/fontforgeexe/displayfonts.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/displayfonts.c	2018-09-23 14:50:31.588567221 +0530
1917f8
@@ -138,6 +138,7 @@
1917f8
 	    float pw,ph, scale;
1917f8
 	    if ( sscanf(cret,"%gx%g",&pw,&ph)!=2 ) {
1917f8
 		IError("Bad Pagesize must be a known name or <num>x<num><units>\nWhere <units> is one of pt (points), mm, cm, in" );
1917f8
+		free(cret);
1917f8
 return( true );
1917f8
 	    }
1917f8
 	    pt = cret+strlen(cret)-1;
1917f8
@@ -152,6 +153,7 @@
1917f8
 		scale = 1;
1917f8
 	    else {
1917f8
 		IError("Bad Pagesize units are unknown\nMust be one of pt (points), mm, cm, in" );
1917f8
+		free(pt);
1917f8
 return( true );
1917f8
 	    }
1917f8
 	    pgwidth = pw*scale; pgheight = ph*scale;
1917f8
@@ -1431,6 +1433,7 @@
1917f8
 	feats[cnt] = 0;
1917f8
 	/* These will be ordered because the list widget will do that */
1917f8
 	SFTFSetFeatures(GWidgetGetControl(di->gw,CID_SampleText),-1,-1,feats);
1917f8
+	free(feats);
1917f8
     }
1917f8
 return( true );
1917f8
 }
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/fontinfo.c fontforge-20170731/fontforgeexe/fontinfo.c
1917f8
--- fontforge-20170731.old/fontforgeexe/fontinfo.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/fontinfo.c	2018-09-23 14:50:31.589567205 +0530
1917f8
@@ -3752,6 +3752,7 @@
1917f8
 	    }
1917f8
 	}
1917f8
     }
1917f8
+    free(changed);
1917f8
 }
1917f8
 
1917f8
 static void StoreTTFNames(struct gfi_data *d) {
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/fontview.c fontforge-20170731/fontforgeexe/fontview.c
1917f8
--- fontforge-20170731.old/fontforgeexe/fontview.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/fontview.c	2018-09-23 14:50:31.590567190 +0530
1917f8
@@ -582,6 +582,7 @@
1917f8
 	GGadgetSetTitle8(fc,newname);
1917f8
 	save_to_dir = *_s2d = s2d;
1917f8
 	SavePrefs(true);
1917f8
+	free(oldname);
1917f8
     }
1917f8
 return( true );
1917f8
 }
1917f8
@@ -3741,12 +3742,15 @@
1917f8
     free(filename);
1917f8
     if ( new==NULL )
1917f8
 return;
1917f8
-    if ( new->fv == &fv->b )		/* Already part of us */
1917f8
+    if ( new->fv == &fv->b ) {		/* Already part of us */
1917f8
+	    free(new);
1917f8
 return;
1917f8
+    }
1917f8
     if ( new->fv != NULL ) {
1917f8
 	if ( ((FontView *) (new->fv))->gw!=NULL )
1917f8
 	    GDrawRaise( ((FontView *) (new->fv))->gw);
1917f8
 	ff_post_error(_("Please close font"),_("Please close %s before inserting it into a CID font"),new->origname);
1917f8
+	free(new);
1917f8
 return;
1917f8
     }
1917f8
     EncMapFree(new->map);
1917f8
@@ -4978,9 +4982,11 @@
1917f8
     nl = NameListByName(namelists[ret]);
1917f8
     if ( nl==NULL ) {
1917f8
 	IError("Couldn't find namelist");
1917f8
+	free(namelists);
1917f8
 return;
1917f8
     } else if ( nl!=NULL && nl->uses_unicode && !allow_utf8_glyphnames) {
1917f8
 	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."));
1917f8
+	free(namelists);
1917f8
 return;
1917f8
     }
1917f8
     SFRenameGlyphsToNamelist(fv->b.sf,nl);
1917f8
@@ -6699,7 +6705,9 @@
1917f8
 	msg = xasprintf ( "%u 0x%x U+%04X \"%.25s\" %.100s",
1917f8
 		localenc, localenc, upos,
1917f8
 		(sc->name == NULL) ? "" : sc->name, uniname );
1917f8
-	if ( uniname != NULL ) free( uniname ); uniname = NULL;
1917f8
+	if ( uniname != NULL ) 
1917f8
+		free( uniname ); 
1917f8
+	uniname = NULL;
1917f8
 
1917f8
 	/* annotation */
1917f8
         char *uniannot = unicode_annot( upos );
1917f8
@@ -8129,6 +8137,7 @@
1917f8
 			free(repr);
1917f8
 			*rpt++ = ' ';
1917f8
 		    }
1917f8
+		    free(repr);
1917f8
 		}
1917f8
 	    }
1917f8
 	    if ( k==0 )
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/fvfontsdlg.c fontforge-20170731/fontforgeexe/fvfontsdlg.c
1917f8
--- fontforge-20170731.old/fontforgeexe/fvfontsdlg.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/fvfontsdlg.c	2018-09-23 14:50:31.590567190 +0530
1917f8
@@ -73,6 +73,7 @@
1917f8
 	file = fpt+2;
1917f8
     } while ( fpt!=NULL );
1917f8
     free(filename);
1917f8
+    free(sf);
1917f8
 }
1917f8
 
1917f8
 GTextInfo *BuildFontList(FontView *except) {
1917f8
@@ -285,6 +286,7 @@
1917f8
     if ( sf==NULL )
1917f8
 return;
1917f8
     FontViewCreate(InterpolateFont(fv->b.sf,sf,amount,fv->b.map->enc),false);
1917f8
+    free(sf);
1917f8
 }
1917f8
 
1917f8
 #define CID_Amount	1000
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/histograms.c fontforge-20170731/fontforgeexe/histograms.c
1917f8
--- fontforge-20170731.old/fontforgeexe/histograms.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/histograms.c	2018-09-23 14:50:31.590567190 +0530
1917f8
@@ -573,8 +573,11 @@
1917f8
     ret2 = GGadgetGetTitle(GWidgetGetControl(hist->gw,CID_SecondaryVal));
1917f8
     hist->done = true;
1917f8
     if ( (*ret1=='\0' || uc_strcmp(ret1,"[]")==0 ) &&
1917f8
-	    (*ret2=='\0' || uc_strcmp(ret2,"[]")==0 ) && p==NULL )
1917f8
+	    (*ret2=='\0' || uc_strcmp(ret2,"[]")==0 ) && p==NULL ){
1917f8
+	    free(ret1);
1917f8
+	    free(ret2);
1917f8
 return;
1917f8
+    }
1917f8
     if ( p==NULL ) {
1917f8
 	hist->sf->private = p = calloc(1,sizeof(struct psdict));
1917f8
 	p->cnt = 10;
1917f8
@@ -583,6 +586,8 @@
1917f8
     }
1917f8
     PSDictChangeEntry(p,primary,temp=cu_copy(ret1)); free(temp);
1917f8
     PSDictChangeEntry(p,secondary,temp=cu_copy(ret2)); free(temp);
1917f8
+    free(ret1);
1917f8
+    free(ret2);
1917f8
 }
1917f8
 
1917f8
 static int leftside_e_h(GWindow gw, GEvent *event) {
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/kernclass.c fontforge-20170731/fontforgeexe/kernclass.c
1917f8
--- fontforge-20170731.old/fontforgeexe/kernclass.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/kernclass.c	2018-09-23 14:50:31.591567174 +0530
1917f8
@@ -1345,6 +1345,7 @@
1917f8
 			KCD_VShow(kcd,i);
1917f8
 		    else
1917f8
 			KCD_HShow(kcd,i);
1917f8
+		    free(name);
1917f8
                     return( true );
1917f8
 		}
1917f8
 		if ( *pt=='(' ) {
1917f8
@@ -1358,7 +1359,9 @@
1917f8
 	/* Otherwise deselect everything */
1917f8
 	if ( nlen!=0 )
1917f8
 	    GMatrixEditActivateRowCol(list,-1,-1);
1917f8
+	free(name);
1917f8
     }
1917f8
+
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -2235,6 +2238,7 @@
1917f8
 
1917f8
     GDrawRequestExpose(kcd->subw,NULL,false);
1917f8
 
1917f8
+    free(other);
1917f8
 return( new );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/lookupui.c fontforge-20170731/fontforgeexe/lookupui.c
1917f8
--- fontforge-20170731.old/fontforgeexe/lookupui.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/lookupui.c	2018-09-23 14:54:04.668283976 +0530
1917f8
@@ -2779,16 +2779,23 @@
1917f8
     char *suffix = GGadgetGetTitle8(GWidgetGetControl(pstkd->gw,CID_Suffix));
1917f8
     SplineChar *alt, *sc;
1917f8
 
1917f8
-    if ( col!=0 || !wasnew || psts[row*cols+0].u.md_str==NULL )
1917f8
+    if ( col!=0 || !wasnew || psts[row*cols+0].u.md_str==NULL ){
1917f8
+	    free(suffix);
1917f8
 return;
1917f8
-    if ( *suffix=='\0' || ( suffix[0]=='.' && suffix[1]=='\0' ))
1917f8
+    }
1917f8
+    if ( *suffix=='\0' || ( suffix[0]=='.' && suffix[1]=='\0' )){
1917f8
+	    free(suffix);
1917f8
 return;
1917f8
+    }
1917f8
     sc = SFGetChar(pstkd->sf,-1,psts[row*cols+0].u.md_str);
1917f8
-    if ( sc==NULL )
1917f8
+    if ( sc==NULL ){
1917f8
+	    free(suffix);
1917f8
 return;
1917f8
+    }
1917f8
     alt = SuffixCheck(sc,suffix);
1917f8
     if ( alt!=NULL )
1917f8
 	psts[row*cols+1].u.md_str = copy(alt->name);
1917f8
+    free(suffix);
1917f8
 }
1917f8
 
1917f8
 static void PSTKD_FinishBoundsEdit(GGadget *g, int row, int col, int wasnew) {
1917f8
@@ -3403,8 +3410,8 @@
1917f8
     if ( *suffix!='\0' && ( suffix[0]!='.' || suffix[1]!='\0' )) {
1917f8
 	free(pstkd->sub->suffix);
1917f8
 	pstkd->sub->suffix = ( *suffix=='.' ) ? copy(suffix+1): copy(suffix);
1917f8
-	free(suffix);
1917f8
     }
1917f8
+    free(suffix);
1917f8
 }
1917f8
 
1917f8
 static int PSTKD_PopulateWithSuffix(GGadget *g, GEvent *e) {
1917f8
@@ -3953,6 +3960,8 @@
1917f8
 error2SFDTrimUndoOldToNew: fclose(nf);
1917f8
 error1SFDTrimUndoOldToNew: fclose(retf);
1917f8
 error0SFDTrimUndoOldToNew:
1917f8
+			   free(nglyph);
1917f8
+			   free(oglyph);
1917f8
     return 0;
1917f8
 }
1917f8
 
1917f8
@@ -4229,9 +4238,11 @@
1917f8
 		dlist_pushfront( (struct dlistnode **)&sf->undoes, (struct dlistnode *)undo );
1917f8
 	    }
1917f8
 //	    printf("we now have %d splinefont level undoes\n", dlist_size((struct dlistnode **)&sf->undoes));
1917f8
+	    free(str);
1917f8
 	}
1917f8
 
1917f8
 	pstkd->done = true;
1917f8
+	free(oldsfd);
1917f8
     }
1917f8
 return( true );
1917f8
 }
1917f8
@@ -6069,6 +6080,7 @@
1917f8
 	while ( (lang = StrNextLang(&pt))!=0 ) {
1917f8
 	    if ( lang==0xffffffff ) {
1917f8
 		ff_post_error(_("Invalid language"), _("Please specify a comma separated list of 4 letter opentype language tags"));
1917f8
+		free(langs);
1917f8
 return( true );
1917f8
 	    }
1917f8
 	}
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/macencui.c fontforge-20170731/fontforgeexe/macencui.c
1917f8
--- fontforge-20170731.old/fontforgeexe/macencui.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/macencui.c	2018-09-23 14:50:31.592567158 +0530
1917f8
@@ -425,6 +425,7 @@
1917f8
 	    nd->done = true;
1917f8
 	}
1917f8
     }
1917f8
+    free(temp);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/metricsview.c fontforge-20170731/fontforgeexe/metricsview.c
1917f8
--- fontforge-20170731.old/fontforgeexe/metricsview.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/metricsview.c	2018-09-23 14:50:31.592567158 +0530
1917f8
@@ -1970,8 +1970,11 @@
1917f8
 	if ( *pt!=mv->chars[i]->unicodeenc &&
1917f8
 		!MVOddMatch(mv,*pt,mv->chars[i]))
1917f8
     break;
1917f8
-    if ( i==mv->clen && *pt=='\0' )
1917f8
-return;					/* Nothing changed */
1917f8
+    if ( i==mv->clen && *pt=='\0' ){
1917f8
+	    free(pt);
1917f8
+return;		
1917f8
+    }	
1917f8
+    /* Nothing changed */
1917f8
     for ( ept=ret+u_strlen(ret)-1, ei=mv->clen-1; ; --ei, --ept )
1917f8
 	if ( ei<0 || ept<ret || (*ept!=mv->chars[ei]->unicodeenc &&
1917f8
 		!MVOddMatch(mv,*ept,mv->chars[ei]))) {
1917f8
@@ -2046,6 +2049,7 @@
1917f8
 
1917f8
     selectUserChosenWordListGlyphs( mv, wll );
1917f8
     GDrawRequestExpose(mv->v,NULL,false);
1917f8
+    free(pt);
1917f8
 }
1917f8
 
1917f8
 GTextInfo mv_text_init[] = {
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/mmdlg.c fontforge-20170731/fontforgeexe/mmdlg.c
1917f8
--- fontforge-20170731.old/fontforgeexe/mmdlg.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/mmdlg.c	2018-09-23 14:50:31.593567143 +0530
1917f8
@@ -1980,6 +1980,7 @@
1917f8
 	enc = default_encoding;
1917f8
     FVReencode((FontViewBase *) fv,enc);
1917f8
     mmw->done = true;
1917f8
+    free(setto);
1917f8
 }
1917f8
 
1917f8
 static void MMW_DoNext(MMW *mmw) {
1917f8
@@ -2374,17 +2375,19 @@
1917f8
 	if ( ti!=NULL && ti->userdata == (void *) -1 ) {
1917f8
 	    temp = GetPostScriptFontName(NULL,false);
1917f8
 	    if ( temp==NULL )
1917f8
-return(true);
1917f8
+		return(true);
1917f8
 	    sf = LoadSplineFont(temp,0);
1917f8
 	    free(temp); temp = NULL;
1917f8
 	    if ( sf==NULL )
1917f8
-return(true);
1917f8
+		return(true);
1917f8
 	    if ( sf->cidmaster!=NULL || sf->subfonts!=0 ) {
1917f8
 		ff_post_error(_("Bad Multiple Master Font"),_("CID keyed fonts may not be a master design of a multiple master font"));
1917f8
-return(true);
1917f8
+		free(sf);
1917f8
+		return(true);
1917f8
 	    } else if ( sf->mm!=NULL ) {
1917f8
 		ff_post_error(_("Bad Multiple Master Font"),_("CID keyed fonts may not be a master design of a multiple master font"));
1917f8
-return(true);
1917f8
+		free(sf);
1917f8
+		return(true);
1917f8
 	    }
1917f8
 	    if ( sf->fv==NULL ) {
1917f8
 		if ( mmw->lcnt>=mmw->lmax ) {
1917f8
@@ -2406,6 +2409,7 @@
1917f8
 	    GGadgetSetTitle(g,ut = uc_copy(sf->fontname));
1917f8
 	    free(ut);
1917f8
 	}
1917f8
+	free(sf);
1917f8
     }
1917f8
 return( true );
1917f8
 }
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/prefs.c fontforge-20170731/fontforgeexe/prefs.c
1917f8
--- fontforge-20170731.old/fontforgeexe/prefs.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/prefs.c	2018-09-23 14:50:31.593567143 +0530
1917f8
@@ -2380,6 +2380,7 @@
1917f8
 		hvarray[si++] = &pgcd[gc-1];
1917f8
 		hvarray[si++] = GCD_ColSpan; hvarray[si++] = GCD_ColSpan;
1917f8
 		y += 28;
1917f8
+		free(nlnames);
1917f8
 	      } break;
1917f8
 	      case pr_string: case pr_file:
1917f8
 		if ( pl->set==SetAutoTraceArgs || ((char **) pl->val)==&mf_args )
1917f8
@@ -2955,6 +2956,7 @@
1917f8
 		hvarray[si++] = &pgcd[gc-1];
1917f8
 		hvarray[si++] = GCD_ColSpan; hvarray[si++] = GCD_ColSpan;
1917f8
 		y += 28;
1917f8
+		free(nlnames);
1917f8
 	      } break;
1917f8
 	      case pr_string: case pr_file:
1917f8
 		if ( pl->set==SetAutoTraceArgs || ((char **) pl->val)==&mf_args )
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/savefontdlg.c fontforge-20170731/fontforgeexe/savefontdlg.c
1917f8
--- fontforge-20170731.old/fontforgeexe/savefontdlg.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/savefontdlg.c	2018-09-23 14:50:31.594567127 +0530
1917f8
@@ -1426,8 +1426,10 @@
1917f8
     oldbitmapstate = GGadgetGetFirstListSelectedItem(d->bmptype);
1917f8
     if ( oldbitmapstate!=bf_none )
1917f8
 	sizes = ParseBitmapSizes(d->bmpsizes,_("Pixel List"),&err;;
1917f8
-    if ( err )
1917f8
+    if ( err ){
1917f8
+	    free(temp);
1917f8
 return;
1917f8
+    }
1917f8
     if ( oldbitmapstate==bf_nfntmacbin && oldformatstate!=ff_pfbmacbin && !nfnt_warned ) {
1917f8
 	nfnt_warned = true;
1917f8
 	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)"));
1917f8
@@ -1484,7 +1486,9 @@
1917f8
 		    d->done = true;
1917f8
 		    d->ret = false;
1917f8
 		    SFValidationWindow(d->sf,layer,oldformatstate);
1917f8
-return;
1917f8
+		    free(sizes);
1917f8
+		    free(temp);
1917f8
+		    return;
1917f8
 		}
1917f8
 		/* Ok... they want to proceed */
1917f8
 	    }
1917f8
@@ -1581,6 +1585,7 @@
1917f8
     free(temp);
1917f8
     d->done = !err;
1917f8
     d->ret = !err;
1917f8
+    free(cur);
1917f8
 }
1917f8
 
1917f8
 static void GFD_doesnt(GIOControl *gio) {
1917f8
@@ -2109,6 +2114,7 @@
1917f8
 	    }
1917f8
 	    if ( MacStyleCode(sf,NULL)!=0 || familycnt<=1 || sf->multilayer ) {
1917f8
 		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."));
1917f8
+		free(familysfs);
1917f8
 return( 0 );
1917f8
 	    } else if ( dup ) {
1917f8
 		MacStyleCode(dup,&psstyle);
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/scstylesui.c fontforge-20170731/fontforgeexe/scstylesui.c
1917f8
--- fontforge-20170731.old/fontforgeexe/scstylesui.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/scstylesui.c	2018-09-23 14:50:31.594567127 +0530
1917f8
@@ -2323,6 +2323,7 @@
1917f8
 	    FVTrans((FontViewBase *) fv,sc,transform,NULL,fvt_dontmovewidth);
1917f8
 	}
1917f8
     }
1917f8
+    free(ret);
1917f8
 }
1917f8
 
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/sftextfield.c fontforge-20170731/fontforgeexe/sftextfield.c
1917f8
--- fontforge-20170731.old/fontforgeexe/sftextfield.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/sftextfield.c	2018-09-23 14:50:31.594567127 +0530
1917f8
@@ -702,8 +702,10 @@
1917f8
     }
1917f8
     for ( cnt=0; scriptlangs[cnt]!=NULL; ++cnt );
1917f8
     i = ff_choose(_("Text from script"),(const char **) scriptlangs,cnt,0,_("Insert random text in the specified script"));
1917f8
-    if ( i==-1 )
1917f8
+    if ( i==-1) {
1917f8
+	    free(freq);
1917f8
 return;
1917f8
+    }
1917f8
     pos = strlen(scriptlangs[i])-10;
1917f8
     script = (scriptlangs[i][pos+0]<<24) |
1917f8
 	     (scriptlangs[i][pos+1]<<16) |
1917f8
@@ -2303,6 +2305,7 @@
1917f8
     }
1917f8
 
1917f8
     SFTFMetaChangeCleanup(st,start,end);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -2323,6 +2326,7 @@
1917f8
     }
1917f8
 
1917f8
     SFTFMetaChangeCleanup(st,start,end);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -2345,6 +2349,7 @@
1917f8
     }
1917f8
 
1917f8
     SFTFMetaChangeCleanup(st,start,end);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -2365,6 +2370,7 @@
1917f8
     }
1917f8
 
1917f8
     SFTFMetaChangeCleanup(st,start,end);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -2385,6 +2391,7 @@
1917f8
     }
1917f8
 
1917f8
     SFTFMetaChangeCleanup(st,start,end);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
@@ -2401,6 +2408,7 @@
1917f8
     }
1917f8
 
1917f8
     SFTFMetaChangeCleanup(st,start,end);
1917f8
+    free(fl);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/statemachine.c fontforge-20170731/fontforgeexe/statemachine.c
1917f8
--- fontforge-20170731.old/fontforgeexe/statemachine.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/statemachine.c	2018-09-23 14:50:31.595567112 +0530
1917f8
@@ -438,6 +438,7 @@
1917f8
 
1917f8
     /* Show changes in main window */
1917f8
     GDrawRequestExpose(smd->gw,NULL,false);
1917f8
+    free(ret8);
1917f8
 return( true );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/fontforgeexe/wordlistparser.c fontforge-20170731/fontforgeexe/wordlistparser.c
1917f8
--- fontforge-20170731.old/fontforgeexe/wordlistparser.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/fontforgeexe/wordlistparser.c	2018-09-23 14:50:31.595567112 +0530
1917f8
@@ -799,7 +799,8 @@
1917f8
         if( element_selected )
1917f8
             uc_strcat( ret, "]" );
1917f8
     }
1917f8
-    
1917f8
+
1917f8
+    free(wll);
1917f8
     return ret;
1917f8
 }
1917f8
 
1917f8
@@ -841,6 +842,7 @@
1917f8
 		{
1917f8
 		    // we can't go back manually!
1917f8
 		    u_strcpy( ret, original_data );
1917f8
+		    free(wll);
1917f8
 		    return ret;
1917f8
 		}
1917f8
 	    }
1917f8
@@ -862,6 +864,7 @@
1917f8
             uc_strcat( ret, "]" );
1917f8
     }
1917f8
 
1917f8
+    free(wll);
1917f8
     return ret;
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/gdraw/gimageclut.c fontforge-20170731/gdraw/gimageclut.c
1917f8
--- fontforge-20170731.old/gdraw/gimageclut.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gimageclut.c	2018-09-23 14:50:31.595567112 +0530
1917f8
@@ -460,9 +460,10 @@
1917f8
 
1917f8
     if ( clut==NULL )
1917f8
 	clut = malloc(sizeof(GClut));
1917f8
-    if ( clutmax<2 || clut==NULL )
1917f8
+    if ( clutmax<2 || clut==NULL ){
1917f8
+	    free(clut);
1917f8
 return( 0 );
1917f8
-
1917f8
+    }
1917f8
     clut->clut_len = 0; clut->is_grey = false;
1917f8
     if ( clutmax>256 ) clutmax = 256;
1917f8
 
1917f8
@@ -555,14 +556,24 @@
1917f8
     if ( test->next==NULL )
1917f8
 return( (GCol *) test );
1917f8
 
1917f8
-    if (( best = (r-test->red))<0 ) best = -best;
1917f8
-    if (( t = (g-test->green))<0 ) t = -t; best += t;
1917f8
-    if (( t = (b-test->blue))<0 ) t = -t; best += t;
1917f8
+    if (( best = (r-test->red))<0 )
1917f8
+	    best = -best;
1917f8
+    if (( t = (g-test->green))<0 )
1917f8
+	    t = -t;
1917f8
+    best += t;
1917f8
+    if (( t = (b-test->blue))<0 )
1917f8
+	    t = -t;
1917f8
+    best += t;
1917f8
     bestcol = test;
1917f8
     for ( test=test->next; test!=NULL; test = test->next ) {
1917f8
-	if (( val = (r-test->red))<0 ) val = -val;
1917f8
-	if (( t = (g-test->green))<0 ) t = -t; val += t;
1917f8
-	if (( t = (b-test->blue))<0 ) t = -t; val += t;
1917f8
+	if (( val = (r-test->red))<0 )
1917f8
+	       val = -val;
1917f8
+	if (( t = (g-test->green))<0 )
1917f8
+	       t = -t;
1917f8
+       	val += t;
1917f8
+	if (( t = (b-test->blue))<0 )
1917f8
+	       t = -t;
1917f8
+       	val += t;
1917f8
 	if ( val
1917f8
 	    val = best;
1917f8
 	    bestcol = test;
1917f8
@@ -612,14 +623,24 @@
1917f8
     if ( test->next==NULL && this->cols[1]==NULL )
1917f8
 return( (GCol *) test );
1917f8
 
1917f8
-    if (( best = (r-test->red))<0 ) best = -best;
1917f8
-    if (( t = (g-test->green))<0 ) t = -t; best += t;
1917f8
-    if (( t = (b-test->blue))<0 ) t = -t; best += t;
1917f8
+    if (( best = (r-test->red))<0 )
1917f8
+	   best = -best;
1917f8
+    if (( t = (g-test->green))<0 )
1917f8
+	    t = -t;
1917f8
+    best += t;
1917f8
+    if (( t = (b-test->blue))<0 )
1917f8
+	    t = -t;
1917f8
+    best += t;
1917f8
     bestcol = test;
1917f8
     for ( test=test->next; test!=NULL; test = test->next ) {
1917f8
-	if (( val = (r-test->red))<0 ) val = -val;
1917f8
-	if (( t = (g-test->green))<0 ) t = -t; val += t;
1917f8
-	if (( t = (b-test->blue))<0 ) t = -t; val += t;
1917f8
+	if (( val = (r-test->red))<0 )
1917f8
+		val = -val;
1917f8
+	if (( t = (g-test->green))<0 )
1917f8
+		t = -t;
1917f8
+	val += t;
1917f8
+	if (( t = (b-test->blue))<0 )
1917f8
+		t = -t;
1917f8
+	val += t;
1917f8
 	if ( val
1917f8
 	    val = best;
1917f8
 	    bestcol = test;
1917f8
@@ -627,9 +648,14 @@
1917f8
     }
1917f8
 
1917f8
     for ( test=this->cols[1]; test!=NULL; test = test->next ) {
1917f8
-	if (( val = (r-test->red))<0 ) val = -val;
1917f8
-	if (( t = (g-test->green))<0 ) t = -t; val += t;
1917f8
-	if (( t = (b-test->blue))<0 ) t = -t; val += t;
1917f8
+	if (( val = (r-test->red))<0 )
1917f8
+		val = -val;
1917f8
+	if (( t = (g-test->green))<0 )
1917f8
+		t = -t;
1917f8
+	val += t;
1917f8
+	if (( t = (b-test->blue))<0 )
1917f8
+		t = -t;
1917f8
+	val += t;
1917f8
 	if ( val
1917f8
 	    val = best;
1917f8
 	    bestcol = test;
1917f8
@@ -656,18 +682,28 @@
1917f8
 return( old );
1917f8
     bestoff = 3*255;
1917f8
     for ( test=test; test!=NULL; test = test->next ) {
1917f8
-	if ( (off = (r-test->red))<0 ) off = -off;
1917f8
-	if ( (t = (g-test->green))<0 ) t = -t; off +=t;
1917f8
-	if ( (b = (g-test->blue))<0 ) t = -t; off +=t;
1917f8
+	if ( (off = (r-test->red))<0 ) 
1917f8
+		off = -off;
1917f8
+	if ( (t = (g-test->green))<0 ) 
1917f8
+		t = -t; 
1917f8
+	off +=t;
1917f8
+	if ( (b = (g-test->blue))<0 ) 
1917f8
+		t = -t; 
1917f8
+	off +=t;
1917f8
 	if ( off
1917f8
 	    bestoff = off;
1917f8
 	    best = test;
1917f8
 	}
1917f8
     }
1917f8
     if ( old!=NULL ) {
1917f8
-	if ( (off = (r-old->red))<0 ) off = -off;
1917f8
-	if ( (t = (g-old->green))<0 ) t = -t; off +=t;
1917f8
-	if ( (b = (g-old->blue))<0 ) t = -t; off +=t;
1917f8
+	if ( (off = (r-old->red))<0 ) 
1917f8
+		off = -off;
1917f8
+	if ( (t = (g-old->green))<0 ) 
1917f8
+		t = -t; 
1917f8
+	off +=t;
1917f8
+	if ( (b = (g-old->blue))<0 ) 
1917f8
+		t = -t; 
1917f8
+	off +=t;
1917f8
 	if ( off
1917f8
 	    bestoff = off;
1917f8
 	    best = old;
1917f8
diff -urN fontforge-20170731.old/gdraw/gimagecvt.c fontforge-20170731/gdraw/gimagecvt.c
1917f8
--- fontforge-20170731.old/gdraw/gimagecvt.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gimagecvt.c	2018-09-23 14:50:31.596567096 +0530
1917f8
@@ -978,6 +978,11 @@
1917f8
     }}
1917f8
     if ( oldrev!=rev )
1917f8
 	    GClut_RevCMapFree(rev);
1917f8
+    free(blue_dith);
1917f8
+    free(green_dith);
1917f8
+    free(red_dith);
1917f8
+    free(hor);
1917f8
+    free(vert);
1917f8
 }
1917f8
 
1917f8
 GImage *GImageResize32(GImage *from, GRect *src, int width, int height, Color trans) {
1917f8
diff -urN fontforge-20170731.old/gdraw/gmatrixedit.c fontforge-20170731/gdraw/gmatrixedit.c
1917f8
--- fontforge-20170731.old/gdraw/gmatrixedit.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gmatrixedit.c	2018-09-23 14:50:31.596567096 +0530
1917f8
@@ -40,7 +40,7 @@
1917f8
 
1917f8
 static GBox gmatrixedit_box = GBOX_EMPTY; /* Don't initialize here */
1917f8
 static GBox gmatrixedit_button_box = GBOX_EMPTY; /* Don't initialize here */
1917f8
-static FontInstance *gmatrixedit_font = NULL, *gmatrixedit_titfont = NULL;
1917f8
+static FontInstance *gmatrixedit_font = NULL, *gmatrixedit_titfont = NULL, *gtitfont = NULL;
1917f8
 static Color gmatrixedit_title_bg = 0x808080, gmatrixedit_title_fg = 0x000000, gmatrixedit_title_divider = 0xffffff;
1917f8
 static Color gmatrixedit_rules = 0x000000;
1917f8
 static Color gmatrixedit_frozencol = 0xff0000,
1917f8
@@ -115,7 +115,8 @@
1917f8
     GDrawDecomposeFont(gmatrixedit_font,&rq;;
1917f8
     rq.point_size = (rq.point_size>=12) ? rq.point_size-2 : rq.point_size>=10 ? rq.point_size-1 : rq.point_size;
1917f8
     rq.weight = 700;
1917f8
-    gmatrixedit_titfont = GResourceFindFont("GMatrixEdit.TitleFont",GDrawInstanciateFont(NULL,&rq));
1917f8
+    gtitfont = GDrawInstanciateFont(NULL,&rq;;
1917f8
+    gmatrixedit_titfont = GResourceFindFont("GMatrixEdit.TitleFont",gtitfont);
1917f8
     gmatrixedit_title_bg = GResourceFindColor("GMatrixEdit.TitleBG",gmatrixedit_title_bg);
1917f8
     gmatrixedit_title_fg = GResourceFindColor("GMatrixEdit.TitleFG",gmatrixedit_title_fg);
1917f8
     gmatrixedit_title_divider = GResourceFindColor("GMatrixEdit.TitleDivider",gmatrixedit_title_divider);
1917f8
diff -urN fontforge-20170731.old/gdraw/gmenu.c fontforge-20170731/gdraw/gmenu.c
1917f8
--- fontforge-20170731.old/gdraw/gmenu.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gmenu.c	2018-09-23 14:50:31.596567096 +0530
1917f8
@@ -145,6 +145,7 @@
1917f8
     menu_3d_look = GResourceFindBool("GMenu.3DLook", menu_3d_look);
1917f8
     gmenubar_inited = true;
1917f8
     _GGroup_Init();
1917f8
+    free(keystr);
1917f8
 }
1917f8
 
1917f8
 typedef struct gmenu {
1917f8
@@ -388,8 +389,12 @@
1917f8
 	    strcat(buffer,".");
1917f8
 	if( stack[i]->ti.text_untranslated )
1917f8
 	{
1917f8
-//	    TRACE("adding %s\n", HKTextInfoToUntranslatedTextFromTextInfo( &stack[i]->ti ));
1917f8
-	    strcat( buffer, HKTextInfoToUntranslatedTextFromTextInfo( &stack[i]->ti ));
1917f8
+	    char *res;
1917f8
+    	    res	= calloc(PATH_MAX, sizeof(char));
1917f8
+	    res = HKTextInfoToUntranslatedTextFromTextInfo( &stack[i]->ti );
1917f8
+//	    TRACE("adding %s\n", res);
1917f8
+	    strcat( buffer, res);
1917f8
+	    free(res);
1917f8
 	}
1917f8
 	else if( stack[i]->ti.text )
1917f8
 	{
1917f8
diff -urN fontforge-20170731.old/gdraw/gpstxtinit.c fontforge-20170731/gdraw/gpstxtinit.c
1917f8
--- fontforge-20170731.old/gdraw/gpstxtinit.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gpstxtinit.c	2018-09-23 14:50:31.596567096 +0530
1917f8
@@ -503,6 +503,7 @@
1917f8
 	}
1917f8
     }
1917f8
     fonts->names_loaded = true;
1917f8
+    free(path);
1917f8
 return( fonts->names_loaded );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/gdraw/gtextinfo.c fontforge-20170731/gdraw/gtextinfo.c
1917f8
--- fontforge-20170731.old/gdraw/gtextinfo.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gtextinfo.c	2018-09-23 14:50:31.597567080 +0530
1917f8
@@ -582,6 +582,7 @@
1917f8
 	    free(fname);
1917f8
 	    ri->filename = fname = absname;
1917f8
 	}
1917f8
+	free(absname);
1917f8
     }
1917f8
     if ( ret==NULL ) {
1917f8
 	ri->filename = NULL;
1917f8
diff -urN fontforge-20170731.old/gdraw/gxdraw.c fontforge-20170731/gdraw/gxdraw.c
1917f8
--- fontforge-20170731.old/gdraw/gxdraw.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gdraw/gxdraw.c	2018-09-23 14:50:31.597567080 +0530
1917f8
@@ -910,7 +910,6 @@
1917f8
 	}
1917f8
 	if ( (wattrs->mask&wam_ititle) && wattrs->icon_title!=NULL ) {
1917f8
 	    XmbSetWMProperties(display,nw->w,NULL,(pt = u2def_copy(wattrs->icon_title)),NULL,0,NULL,NULL,NULL);
1917f8
-	    free(pt);
1917f8
 	}
1917f8
 	if ( (wattrs->mask&wam_utf8_wtitle) && wattrs->utf8_window_title!=NULL ) {
1917f8
 #ifdef X_HAVE_UTF8_STRING
1917f8
@@ -918,7 +917,7 @@
1917f8
 #else
1917f8
 	    unichar_t *tit = utf82u_copy(wattrs->utf8_window_title);
1917f8
 	    XmbSetWMProperties(display,nw->w,(pt = u2def_copy(tit)),NULL,NULL,0,NULL,NULL,NULL);
1917f8
-	    free(pt); free(tit);
1917f8
+	    free(tit);
1917f8
 #endif
1917f8
 	}
1917f8
 	if ( (wattrs->mask&wam_utf8_ititle) && wattrs->utf8_icon_title!=NULL ) {
1917f8
@@ -927,7 +926,7 @@
1917f8
 #else
1917f8
 	    unichar_t *tit = utf82u_copy(wattrs->utf8_icon_title);
1917f8
 	    XmbSetWMProperties(display,nw->w,NULL,(pt = u2def_copy(tit)),NULL,0,NULL,NULL,NULL);
1917f8
-	    free(pt); free(tit);
1917f8
+	    free(tit);
1917f8
 #endif
1917f8
 	}
1917f8
 	s_h.x = pos->x; s_h.y = pos->y;
1917f8
diff -urN fontforge-20170731.old/gutils/gimagereadrgb.c fontforge-20170731/gutils/gimagereadrgb.c
1917f8
--- fontforge-20170731.old/gutils/gimagereadrgb.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gutils/gimagereadrgb.c	2018-09-23 14:50:31.597567080 +0530
1917f8
@@ -313,6 +313,7 @@
1917f8
 	    free(r); free(g); free(b); free(a);
1917f8
 	}
1917f8
     }
1917f8
+    free(fp);
1917f8
     return( ret );
1917f8
 
1917f8
 errorGImageReadRgbFile:
1917f8
diff -urN fontforge-20170731.old/gutils/gioftp.c fontforge-20170731/gutils/gioftp.c
1917f8
--- fontforge-20170731.old/gutils/gioftp.c	2017-07-31 03:19:01.000000000 +0530
1917f8
+++ fontforge-20170731/gutils/gioftp.c	2018-09-23 14:50:31.598567065 +0530
1917f8
@@ -697,6 +697,7 @@
1917f8
     if ( ctl!=-1 ) close(ctl);
1917f8
     free(path);
1917f8
     free(host); free(username); free(password);
1917f8
+    free(had);
1917f8
 return( NULL );
1917f8
 }
1917f8
 
1917f8
diff -urN fontforge-20170731.old/pycontrib/FontCompare/fc/GlyphConsistency.py fontforge-20170731/pycontrib/FontCompare/fc/GlyphConsistency.py
1917f8
--- fontforge-20170731.old/pycontrib/FontCompare/fc/GlyphConsistency.py	2018-09-21 13:53:18.533769952 +0530
1917f8
+++ fontforge-20170731/pycontrib/FontCompare/fc/GlyphConsistency.py	2018-09-23 14:50:31.598567065 +0530
1917f8
@@ -83,7 +83,7 @@
1917f8
                 if not font[i].boundingBox()[3] in ymax_cords:
1917f8
                     ymax_cords.append(font[i].boundingBox()[3])
1917f8
                 if not font[i].left_side_bearing in lbearing:
1917f8
-                    rbearing.append(font[i].left_side_bearing)
1917f8
+                    lbearing.append(font[i].left_side_bearing)
1917f8
                 if not font[i].right_side_bearing in rbearing:
1917f8
                     rbearing.append(font[i].right_side_bearing)
1917f8
                 if not font[i].layer_cnt in layer_cnts: