Skip to content

diff: fix a memory leak

Ramsay Jones git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bitsxdiff/xprepare.c+1 -10 replies
2/2xdiff/xprepare: fix a memory leakxdiff/xprepare.c+1 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] diff: fix a memory leak

A recent memory leak patch from Patrick, commit 4867f1184 ("xdiff/xmerge: fix memory leak in xdl_merge", 23-02-2016), reminded me that I had a similar patch lying around.

After checking that it wasn't the same one, I dusted it off, and split it into these two patches.

One of the reasons for not sending it earlier was that it is not very likely to happen (without very large files), and I had to use the debugger to confirm the leak and the fix.

[If you want to do so yourself, then I suggest that you use two files that actually have changes and do 'run --no-pager diff --no-index file-1 file-2'. set breakpoints on xdl_prepare_env, xdl_init_classifier, xdl_free_classifier, xdl_optimize_ctxs and xdl_cleanup_records. You have to force xdl_cleanup_records to return -1 to simulate an OOM. Since xdl_free_classifier does not set the allocated fields to NULL, you have to make sure that you do/don't hit that breakpoint before the return at line #304/305.]

Ramsay Jones (2):
xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits xdiff/xprepare: fix a memory leak

 xdiff/xprepare.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.0