<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.c, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-03-23T21:09:31Z</updated>
<entry>
<title>Merge branch 'ab/plug-random-leaks'</title>
<updated>2022-03-23T21:09:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-23T21:09:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=361c2566c0aef409a7e266f0a3192a8f62f157a8'/>
<id>urn:sha1:361c2566c0aef409a7e266f0a3192a8f62f157a8</id>
<content type='text'>
Double-free fix for a recently merged topic.

* ab/plug-random-leaks:
  diff.c: fix a double-free regression in a18d66cefb
  tests: demonstrate "show --word-diff --color-moved" regression
</content>
</entry>
<entry>
<title>diff.c: fix a double-free regression in a18d66cefb</title>
<updated>2022-03-17T15:49:13Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-17T14:55:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=77e56d55ba6eee1c6efe08d4872e5001ed8e563a'/>
<id>urn:sha1:77e56d55ba6eee1c6efe08d4872e5001ed8e563a</id>
<content type='text'>
My a18d66cefb9 (diff.c: free "buf" in diff_words_flush(), 2022-03-04)
has what it retrospect is a rather obvious bug (I don't know what I
was thinking, if it all): We use the "emitted_symbols" allocation in
append_emitted_diff_symbol() N times, but starting with a18d66cefb9
we'd free it after its first use!

The correct way to free this data would have been to add the free() to
the existing free_diff_words_data() function, so let's do that. The
"ecbdata-&gt;diff_words-&gt;opt-&gt;emitted_symbols" might be NULL, so let's
add a trivial free_emitted_diff_symbols() helper next to the function
that appends to it.

This fixes the "no effect on show from" leak tested for in the
preceding commit. Perhaps confusingly this change will skip that test
under SANITIZE=leak, but otherwise opt-in the
"t4015-diff-whitespace.sh" test.

The reason is that a18d66cefb9 "fixed" the leak in the preceding "no
effect on diff" test, but for the first call to diff_words_flush() the
"wol-&gt;buf" would be NULL, so we wouldn't double-free (and
SANITIZE=address would see nothing amiss). With this change we'll
still pass that test, showing that we've also fixed leaks on this
codepath.

We then have to skip the new "no effect on show" test because it
happens to trip over an unrelated memory leak (in revision.c). The
same goes for "move detection with submodules". Both of them pass with
SANITIZE=address though, which would error on the "no effect on show"
test before this change.

Reported-by: Michael J Gruber &lt;git@grubix.eu&gt;
Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/plug-random-leaks'</title>
<updated>2022-03-13T22:56:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-13T22:56:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ccafbbfb4ee29ee3e9fab1e5e22ec3b88a5aec4f'/>
<id>urn:sha1:ccafbbfb4ee29ee3e9fab1e5e22ec3b88a5aec4f</id>
<content type='text'>
Plug random memory leaks.

* ab/plug-random-leaks:
  repository.c: free the "path cache" in repo_clear()
  range-diff: plug memory leak in read_patches()
  range-diff: plug memory leak in common invocation
  lockfile API users: simplify and don't leak "path"
  commit-graph: stop fill_oids_from_packs() progress on error and free()
  commit-graph: fix memory leak in misused string_list API
  submodule--helper: fix trivial leak in module_add()
  transport: stop needlessly copying bundle header references
  bundle: call strvec_clear() on allocated strvec
  remote-curl.c: free memory in cmd_main()
  urlmatch.c: add and use a *_release() function
  diff.c: free "buf" in diff_words_flush()
  merge-base: free() allocated "struct commit **" list
  index-pack: fix memory leaks
</content>
</entry>
<entry>
<title>Merge branch 'ac/usage-string-fixups'</title>
<updated>2022-03-07T05:25:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-07T05:25:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6d8d81ec36081328638a886664e8d54434ca729a'/>
<id>urn:sha1:6d8d81ec36081328638a886664e8d54434ca729a</id>
<content type='text'>
Usage-string normalization.

* ac/usage-string-fixups:
  amend remaining usage strings according to style guide
</content>
</entry>
<entry>
<title>diff.c: free "buf" in diff_words_flush()</title>
<updated>2022-03-04T21:24:18Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-04T18:32:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a18d66cefb9e5ee4fd49be1d60e90523cd89ca0f'/>
<id>urn:sha1:a18d66cefb9e5ee4fd49be1d60e90523cd89ca0f</id>
<content type='text'>
Amend the freeing logic added in e6e045f8031 (diff.c: buffer all
output if asked to, 2017-06-29) to free the containing "buf" in
addition to its members.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/diff-free-more'</title>
<updated>2022-02-25T23:47:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-25T23:47:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=362f869ff2dbc389234ecd8c4b996a9e507c39d7'/>
<id>urn:sha1:362f869ff2dbc389234ecd8c4b996a9e507c39d7</id>
<content type='text'>
Leakfixes.

* ab/diff-free-more:
  diff.[ch]: have diff_free() free options-&gt;parseopts
  diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)
</content>
</entry>
<entry>
<title>amend remaining usage strings according to style guide</title>
<updated>2022-02-23T22:43:10Z</updated>
<author>
<name>Abhradeep Chakraborty</name>
<email>chakrabortyabhradeep79@gmail.com</email>
</author>
<published>2022-02-23T14:27:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9e1f22c8ad1dc51d510af68278776beb00378c07'/>
<id>urn:sha1:9e1f22c8ad1dc51d510af68278776beb00378c07</id>
<content type='text'>
Usage strings for git (sub)command flags has a style guide that
suggests - first letter should not capitalized (unless required)
and it should skip full-stop at the end of line. But there are
some files where usage-strings do not follow the above mentioned
guide.

Amend the usage strings that don't follow the style convention/guide.

Signed-off-by: Abhradeep Chakraborty &lt;chakrabortyabhradeep79@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/diff-filter-negation-fix'</title>
<updated>2022-02-16T23:14:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-16T23:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9a160990ef3a16fab8d54752d0d9b981d15b00c5'/>
<id>urn:sha1:9a160990ef3a16fab8d54752d0d9b981d15b00c5</id>
<content type='text'>
"git diff --diff-filter=aR" is now parsed correctly.

* js/diff-filter-negation-fix:
  diff-filter: be more careful when looking for negative bits
  diff.c: move the diff filter bits definitions up a bit
  docs(diff): lose incorrect claim about `diff-files --diff-filter=A`
</content>
</entry>
<entry>
<title>Merge branch 'en/remerge-diff'</title>
<updated>2022-02-16T23:14:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-16T23:14:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=90b7153806af46ca62b85a92a2810015be2453d4'/>
<id>urn:sha1:90b7153806af46ca62b85a92a2810015be2453d4</id>
<content type='text'>
"git log --remerge-diff" shows the difference from mechanical merge
result and the result that is actually recorded in a merge commit.

* en/remerge-diff:
  diff-merges: avoid history simplifications when diffing merges
  merge-ort: mark conflict/warning messages from inner merges as omittable
  show, log: include conflict/warning messages in --remerge-diff headers
  diff: add ability to insert additional headers for paths
  merge-ort: format messages slightly different for use in headers
  merge-ort: mark a few more conflict messages as omittable
  merge-ort: capture and print ll-merge warnings in our preferred fashion
  ll-merge: make callers responsible for showing warnings
  log: clean unneeded objects during `log --remerge-diff`
  show, log: provide a --remerge-diff capability
</content>
</entry>
<entry>
<title>diff.[ch]: have diff_free() free options-&gt;parseopts</title>
<updated>2022-02-16T21:50:37Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-02-16T10:56:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6ee36364eb32287f071878a91d3bbcd86313754a'/>
<id>urn:sha1:6ee36364eb32287f071878a91d3bbcd86313754a</id>
<content type='text'>
The "struct option" added in 4a288478394 (diff.c: prepare to use
parse_options() for parsing, 2019-01-27) would be free'd in the case
of diff_setup_done() being called.

But not all codepaths that allocate it reach that,
e.g. "t6427-diff3-conflict-markers.sh" will now free memory that it
didn't free before. By using FREE_AND_NULL() here (which
diff_setup_done() also does) we ensure that we free the memory, and
that we won't have double-free's.

Before this running:

    ./t6427-diff3-conflict-markers.sh -vixd --run=7

Would report:

    SUMMARY: LeakSanitizer: 7823 byte(s) leaked in 6 allocation(s).

But now we'll report:

    SUMMARY: LeakSanitizer: 703 byte(s) leaked in 5 allocation(s).

I.e. the largest leak in that particular test has now been addressed.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
