Skip to content

Commit b722c45

Browse files
committed
xdiff: use xdl_free not free
We've added a lovely abstraction layer in xdiff so that it can call our allocation functions. But it also needs to call our free functions. We missed some `free` calls in `xmerge.c`. Update them to use `xdl_free`. Without this, we will pass a pointer allocated with a custom allocator to the system free function. 💣
1 parent c845056 commit b722c45

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/xdiff/xdiff.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
#if !defined(XDIFF_H)
2424
#define XDIFF_H
2525

26-
#include "git-xdiff.h"
27-
2826
#ifdef __cplusplus
2927
extern "C" {
3028
#endif /* #ifdef __cplusplus */
3129

30+
#include "git-xdiff.h"
31+
3232
/* xpparm_t.flags */
3333
#define XDF_NEED_MINIMAL (1 << 0)
3434

src/xdiff/xmerge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int xdl_cleanup_merge(xdmerge_t *c)
8888
if (c->mode == 0)
8989
count++;
9090
next_c = c->next;
91-
free(c);
91+
xdl_free(c);
9292
}
9393
return count;
9494
}
@@ -456,7 +456,7 @@ static void xdl_merge_two_conflicts(xdmerge_t *m)
456456
m->chg1 = next_m->i1 + next_m->chg1 - m->i1;
457457
m->chg2 = next_m->i2 + next_m->chg2 - m->i2;
458458
m->next = next_m->next;
459-
free(next_m);
459+
xdl_free(next_m);
460460
}
461461

462462
/*

0 commit comments

Comments
 (0)