diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c index d01cbdd..c2ffb03 100644 --- a/xdiff/xpatience.c +++ b/xdiff/xpatience.c @@ -203,8 +203,10 @@ static struct entry *find_longest_common_sequence(struct hashmap *map) } /* No common unique lines were found */ - if (!longest) + if (!longest) { + xdl_free(sequence); return NULL; + } /* Iterate starting at the last element, adjusting the "next" members */ entry = sequence[longest - 1]; @@ -213,6 +215,7 @@ static struct entry *find_longest_common_sequence(struct hashmap *map) entry->previous->next = entry; entry = entry->previous; } + xdl_free(sequence); return entry; } @@ -350,6 +353,7 @@ static int patience_diff(mmfile_t *file1, mmfile_t *file2, env->xdf1.rchg[line1++ - 1] = 1; while(count2--) env->xdf2.rchg[line2++ - 1] = 1; + xdl_free(map.entries); return 0; } @@ -361,6 +365,7 @@ static int patience_diff(mmfile_t *file1, mmfile_t *file2, result = fall_back_to_classic_diff(&map, line1, count1, line2, count2); + xdl_free(map.entries); return result; }