git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Mar 4, 2016, 23:07 UTC
Message-ID
<56DA153C.1060802@ramsayjones.plus.com>

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(-)
-- 
2.7.0
Message 1 of 1 in “diff: fix a memory leak”
  1. 0/2 diff: fix a memory leakRamsay Jones, Mar 4, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.