<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.4.9</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-06-25T18:02:11Z</updated>
<entry>
<title>Merge branch 'jk/diagnose-config-mmap-failure' into maint</title>
<updated>2015-06-25T18:02:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-25T18:02:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5baf18a404a9713e1b75161855cacbfec32fcf2'/>
<id>urn:sha1:c5baf18a404a9713e1b75161855cacbfec32fcf2</id>
<content type='text'>
The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index
</content>
</entry>
<entry>
<title>read-cache.c: drop PROT_WRITE from mmap of index</title>
<updated>2015-05-28T18:32:04Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-05-28T07:54:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a1293ef7c3690829a6ac47fc45f3f26b96b5c9f5'/>
<id>urn:sha1:a1293ef7c3690829a6ac47fc45f3f26b96b5c9f5</id>
<content type='text'>
Once upon a time, git's in-memory representation of a cache
entry actually pointed to the mmap'd on-disk data. So in
520fc24 (Allow writing to the private index file mapping.,
2005-04-26), we specified PROT_WRITE so that we could tweak
the entries while we run (in our own MAP_PRIVATE copy-on-write
version, of course).

Later, 7a51ed6 (Make on-disk index representation separate
from in-core one, 2008-01-14) stopped doing this; we copy
the data into our in-core representation, and then drop the
mmap immediately. We can therefore drop the PROT_WRITE flag.
It's probably not hurting anything as it is, but it's
potentially confusing.

Note that we could also mark the mapping as "const" to
verify that we never write to it. However, we don't
typically do that for our other maps, as it then requires
casting to munmap() it.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/leaks'</title>
<updated>2015-03-27T20:02:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-27T20:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=553c622b685f0a7a83c77617377f08019d76c682'/>
<id>urn:sha1:553c622b685f0a7a83c77617377f08019d76c682</id>
<content type='text'>
* sb/leaks:
  http: release the memory of a http pack request as well
  read-cache: fix memleak
  add_to_index(): free unused cache-entry
  commit.c: fix a memory leak
  http-push: remove unneeded cleanup
  merge-recursive: fix memleaks
  merge-blobs.c: fix a memleak
  builtin/apply.c: fix a memleak
  update-index: fix a memleak
  read-cache: free cache entry in add_to_index in case of early return
</content>
</entry>
<entry>
<title>Merge branch 'tg/fix-check-order-with-split-index'</title>
<updated>2015-03-25T19:54:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-25T19:54:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a801bb8c297737d99a0b20d61a3a956f0c92a3b9'/>
<id>urn:sha1:a801bb8c297737d99a0b20d61a3a956f0c92a3b9</id>
<content type='text'>
The split-index mode introduced at v2.3.0-rc0~41 was broken in the
codepath to protect us against a broken reimplementation of Git
that writes an invalid index with duplicated index entries, etc.

* tg/fix-check-order-with-split-index:
  read-cache: fix reading of split index
</content>
</entry>
<entry>
<title>read-cache: fix memleak</title>
<updated>2015-03-23T18:12:59Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2015-03-23T17:57:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=915e44c6357f3bd9d5fa498a201872c4367302d3'/>
<id>urn:sha1:915e44c6357f3bd9d5fa498a201872c4367302d3</id>
<content type='text'>
`ce` is allocated in make_cache_entry and should be freed if it is not
used any more. refresh_cache_entry as a wrapper around refresh_cache_ent
will either return

 - the `ce` given as the parameter, when it was up-to-date;
 - a new updated cache entry which is allocated to new memory; or
 - a NULL when refreshing failed.

In the latter two cases, the original cache-entry `ce` is not used
and needs to be freed.  The rule can be expressed as "if the return
value from refresh is different from the original ce, ce is no
longer used."

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add_to_index(): free unused cache-entry</title>
<updated>2015-03-23T18:12:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-23T17:58:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=067178ed8a7822e6bc88ad606b707fc33658e6fc'/>
<id>urn:sha1:067178ed8a7822e6bc88ad606b707fc33658e6fc</id>
<content type='text'>
We allocate a cache-entry pretty early in the function and then
decide either not to do anything when we are pretending to add, or
add it and then get an error (another possibility is obviously to
succeed).

When pretending or failing to add, we forgot to free the
cache-entry.

Noticed during a discussion on Stefan's patch to change the coding
style without fixing the issue ;-)

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: free cache entry in add_to_index in case of early return</title>
<updated>2015-03-22T19:11:25Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2015-03-21T00:28:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2d9426b049335c1a39be7ea7416094e944bfe63c'/>
<id>urn:sha1:2d9426b049335c1a39be7ea7416094e944bfe63c</id>
<content type='text'>
This frees `ce` would be leaking in the error path.

Additionally a free is moved towards the return. This helps code
readability as we often have this pattern of freeing resources just
before return/exit and not in between the code.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: fix reading of split index</title>
<updated>2015-03-20T21:56:30Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2015-03-20T21:43:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=03f15a79a9006d819a25fe04199f9302ad4aaea0'/>
<id>urn:sha1:03f15a79a9006d819a25fe04199f9302ad4aaea0</id>
<content type='text'>
The split index extension uses ewah bitmaps to mark index entries as
deleted, instead of removing them from the index directly.  This can
result in an on-disk index, in which entries of stage #0 and higher
stages appear, which are removed later when the index bases are merged.

15999d0 read_index_from(): catch out of order entries when reading an
index file introduces a check which checks if the entries are in order
after each index entry is read in do_read_index.  This check may however
fail when a split index is read.

Fix this by moving checking the index after we know there is no split
index or after the split index bases are successfully merged instead.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/plug-leak-in-make-cache-entry'</title>
<updated>2015-02-25T23:40:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-02-25T23:40:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b4e8fefc7f4c98769172c1ecb5bc10dab637cc5b'/>
<id>urn:sha1:b4e8fefc7f4c98769172c1ecb5bc10dab637cc5b</id>
<content type='text'>
"update-index --refresh" used to leak when an entry cannot be
refreshed for whatever reason.

* sb/plug-leak-in-make-cache-entry:
  read-cache.c: free cache entry when refreshing fails
</content>
</entry>
<entry>
<title>read-cache.c: free cache entry when refreshing fails</title>
<updated>2015-02-17T18:42:43Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2015-02-17T18:06:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bc1c2caa7397e7e462f0cc7631a40f6e7cd480ab'/>
<id>urn:sha1:bc1c2caa7397e7e462f0cc7631a40f6e7cd480ab</id>
<content type='text'>
This fixes a memory leak when building the cache entries as
refresh_cache_entry may decide to return NULL, but it does not
free the cache entry structure which was passed in as an argument.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
