summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diff.c1
-rw-r--r--xdiff-interface.c15
-rw-r--r--xdiff-interface.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 43835d7..892921c 100644
--- a/diff.c
+++ b/diff.c
@@ -1603,6 +1603,7 @@ static void builtin_diff(const char *name_a,
free(mf1.ptr);
if (textconv_two)
free(mf2.ptr);
+ xdiff_clear_find_func(&xecfg);
}
free_ab_and_return:
diff --git a/xdiff-interface.c b/xdiff-interface.c
index b9b0db8..01f14fb 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -309,6 +309,21 @@ void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value, int cflags)
}
}
+void xdiff_clear_find_func(xdemitconf_t *xecfg)
+{
+ if (xecfg->find_func) {
+ int i;
+ struct ff_regs *regs = xecfg->find_func_priv;
+
+ for (i = 0; i < regs->nr; i++)
+ regfree(&regs->array[i].re);
+ free(regs->array);
+ free(regs);
+ xecfg->find_func = NULL;
+ xecfg->find_func_priv = NULL;
+ }
+}
+
int git_xmerge_style = -1;
int git_xmerge_config(const char *var, const char *value, void *cb)
diff --git a/xdiff-interface.h b/xdiff-interface.h
index 7352b9a..55572c3 100644
--- a/xdiff-interface.h
+++ b/xdiff-interface.h
@@ -21,6 +21,7 @@ int read_mmfile(mmfile_t *ptr, const char *filename);
int buffer_is_binary(const char *ptr, unsigned long size);
extern void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line, int cflags);
+extern void xdiff_clear_find_func(xdemitconf_t *xecfg);
extern int git_xmerge_config(const char *var, const char *value, void *cb);
extern int git_xmerge_style;