git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] diff: fix a memory leak
@ 2016-03-04 23:07 Ramsay Jones
  0 siblings, 0 replies; only message in thread
From: Ramsay Jones @ 2016-03-04 23:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-04 23:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 23:07 [PATCH 0/2] diff: fix a memory leak Ramsay Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).