Re: [PATCH] unpack-trees: release oid_array after use in check_updates()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/25/2018 12:31 PM, René Scharfe wrote:
Signed-off-by: Rene Scharfe <l.s.r@xxxxxx>
---
That leak was introduced by c0c578b33c (unpack-trees: batch fetching of
missing blobs).

  unpack-trees.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/unpack-trees.c b/unpack-trees.c
index d5685891a5..e73745051e 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -379,30 +379,31 @@ static int check_updates(struct unpack_trees_options *o)
  		struct oid_array to_fetch = OID_ARRAY_INIT;
  		int fetch_if_missing_store = fetch_if_missing;
  		fetch_if_missing = 0;
  		for (i = 0; i < index->cache_nr; i++) {
  			struct cache_entry *ce = index->cache[i];
  			if ((ce->ce_flags & CE_UPDATE) &&
  			    !S_ISGITLINK(ce->ce_mode)) {
  				if (!has_object_file(&ce->oid))
  					oid_array_append(&to_fetch, &ce->oid);
  			}
  		}
  		if (to_fetch.nr)
  			fetch_objects(repository_format_partial_clone,
  				      &to_fetch);
  		fetch_if_missing = fetch_if_missing_store;
+		oid_array_clear(&to_fetch);
  	}
  	for (i = 0; i < index->cache_nr; i++) {
  		struct cache_entry *ce = index->cache[i];
if (ce->ce_flags & CE_UPDATE) {
  			if (ce->ce_flags & CE_WT_REMOVE)
  				die("BUG: both update and delete flags are set on %s",
  				    ce->name);
  			display_progress(progress, ++cnt);
  			ce->ce_flags &= ~CE_UPDATE;
  			if (o->update && !o->dry_run) {
  				errs |= checkout_entry(ce, &state, NULL);
  			}
  		}
  	}

Ack. Looks correct.

-Stolee



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux