Merge branch 'ma/leakplugs'

Memory leaks in various codepaths have been plugged.

* ma/leakplugs:
  pack-bitmap[-write]: use `object_array_clear()`, don't leak
  object_array: add and use `object_array_pop()`
  object_array: use `object_array_clear()`, not `free()`
  leak_pending: use `object_array_clear()`, not `free()`
  commit: fix memory leak in `reduce_heads()`
  builtin/commit: fix memory leak in `prepare_index()`
This commit is contained in:
Junio C Hamano
2017-09-29 11:23:43 +09:00
17 changed files with 75 additions and 35 deletions

View File

@ -150,6 +150,17 @@ struct rev_info {
date_mode_explicit:1,
preserve_subject:1;
unsigned int disable_stdin:1;
/*
* Set `leak_pending` to prevent `prepare_revision_walk()` from clearing
* the array of pending objects (`pending`). It will still forget about
* the array and its entries, so they really are leaked. This can be
* useful if the `struct object_array` `pending` is copied before
* calling `prepare_revision_walk()`. By setting `leak_pending`, you
* effectively claim ownership of the old array, so you should most
* likely call `object_array_clear(&pending_copy)` once you are done.
* Observe that this is about ownership of the array and its entries,
* not the commits referenced by those entries.
*/
unsigned int leak_pending:1;
/* --show-linear-break */
unsigned int track_linear:1,