Skip to content

Commit

Permalink
Merge pull request #1777 from fontforge/coverity_fixes_20141007_1
Browse files Browse the repository at this point in the history
Fix defects from the groups merge.
  • Loading branch information
frank-trampe committed Oct 8, 2014
2 parents 8ae0caa + 33e09f1 commit df39e9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions fontforge/autowidth2.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,13 @@ return;
if (kc->firsts != NULL) {
int tmppos;
for (tmppos = 0; tmppos < kc->first_cnt; tmppos++)
if (kc->firsts[tmppos] != NULL) { free(kc->firsts); kc->firsts = NULL; }
if (kc->firsts[tmppos] != NULL) { free(kc->firsts[tmppos]); kc->firsts[tmppos] = NULL; }
free(kc->firsts); kc->firsts = NULL;
}
if (kc->seconds != NULL) {
int tmppos;
for (tmppos = 0; tmppos < kc->second_cnt; tmppos++)
if (kc->seconds[tmppos] != NULL) { free(kc->seconds); kc->seconds = NULL; }
if (kc->seconds[tmppos] != NULL) { free(kc->seconds[tmppos]); kc->seconds[tmppos] = NULL; }
free(kc->seconds); kc->seconds = NULL;
}
free(kc->offsets);
Expand All @@ -852,13 +852,13 @@ return;
if (kc->firsts_names != NULL) {
int tmppos;
for (tmppos = 0; tmppos < kc->first_cnt; tmppos++)
if (kc->firsts_names[tmppos] != NULL) { free(kc->firsts_names); kc->firsts_names = NULL; }
if (kc->firsts_names[tmppos] != NULL) { free(kc->firsts_names[tmppos]); kc->firsts_names[tmppos] = NULL; }
free(kc->firsts_names); kc->firsts_names = NULL;
}
if (kc->seconds_names != NULL) {
int tmppos;
for (tmppos = 0; tmppos < kc->second_cnt; tmppos++)
if (kc->seconds_names[tmppos] != NULL) { free(kc->seconds_names); kc->seconds_names = NULL; }
if (kc->seconds_names[tmppos] != NULL) { free(kc->seconds_names[tmppos]); kc->seconds_names[tmppos] = NULL; }
free(kc->seconds_names); kc->seconds_names = NULL;
}
if (kc->firsts_flags != NULL) { free(kc->firsts_flags); kc->firsts_flags = NULL; }
Expand Down
1 change: 1 addition & 0 deletions fontforge/ufo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,7 @@ int ufo_kerning_tree_attempt_insert(struct ufo_kerning_tree_session *session, co
}
}
free(tmppairname); tmppairname = NULL;
return 0;
}


Expand Down
4 changes: 2 additions & 2 deletions fontforgeexe/kernclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ static void KCD_RowMotion(GGadget *g,int oldr, int newr) {
kcd->seconds_names[oldr] = kcd->seconds_names[newr];
kcd->seconds_names[newr] = name;
}
if (kcd->firsts_flags) {
if (kcd->seconds_flags) {
int flags = kcd->seconds_flags[oldr];
kcd->seconds_flags[oldr] = kcd->seconds_flags[newr];
kcd->seconds_flags[newr] = flags;
Expand Down Expand Up @@ -2341,7 +2341,7 @@ static void KCD_DeleteClass(GGadget *g,int whichclass) {
memmove(kcd->firsts_names+whichclass, kcd->firsts_names+whichclass + 1, (kcd->first_cnt - whichclass - 1) * sizeof(char*));
kcd->firsts_names = realloc(kcd->firsts_names, (kcd->first_cnt - 1) * sizeof(char*));
}
if (kcd->seconds_flags) {
if (kcd->firsts_flags) {
memmove(kcd->firsts_flags+whichclass, kcd->firsts_flags+whichclass + 1, (kcd->first_cnt - whichclass - 1) * sizeof(int));
kcd->firsts_flags = realloc(kcd->firsts_flags, (kcd->first_cnt - 1) * sizeof(int));
}
Expand Down

0 comments on commit df39e9f

Please sign in to comment.