* [PATCH] unpack-trees: release oid_array after use in check_updates()
@ 2018-03-25 16:31 René Scharfe
2018-03-25 18:33 ` Derrick Stolee
0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2018-03-25 16:31 UTC (permalink / raw)
To: Git List; +Cc: Jonathan Tan, Junio C Hamano
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
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);
}
}
}
--
2.16.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] unpack-trees: release oid_array after use in check_updates()
2018-03-25 16:31 [PATCH] unpack-trees: release oid_array after use in check_updates() René Scharfe
@ 2018-03-25 18:33 ` Derrick Stolee
0 siblings, 0 replies; 2+ messages in thread
From: Derrick Stolee @ 2018-03-25 18:33 UTC (permalink / raw)
To: René Scharfe, Git List; +Cc: Jonathan Tan, Junio C Hamano
On 3/25/2018 12:31 PM, René Scharfe wrote:
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-25 18:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-25 16:31 [PATCH] unpack-trees: release oid_array after use in check_updates() René Scharfe
2018-03-25 18:33 ` Derrick Stolee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.