Merge branch 'jk/plug-list-object-filter-leaks'

The code that manages list-object-filter structure, used in partial
clones, leaked the instances, which has been plugged.

* jk/plug-list-object-filter-leaks:
  prepare_repo_settings(): plug leak of config values
  list_objects_filter_options: plug leak of filter_spec strings
  transport: free filter options in disconnect_git()
  transport: deep-copy object-filter struct for fetch-pack
  list_objects_filter_copy(): deep-copy sparse_oid_name field
This commit is contained in:
Junio C Hamano
2022-09-14 12:56:40 -07:00
3 changed files with 21 additions and 11 deletions

View File

@ -22,7 +22,7 @@ void prepare_repo_settings(struct repository *r)
{
int experimental;
int value;
char *strval;
const char *strval;
int manyfiles;
if (!r->gitdir)
@ -77,7 +77,7 @@ void prepare_repo_settings(struct repository *r)
if (!repo_config_get_int(r, "index.version", &value))
r->settings.index_version = value;
if (!repo_config_get_string(r, "core.untrackedcache", &strval)) {
if (!repo_config_get_string_tmp(r, "core.untrackedcache", &strval)) {
int v = git_parse_maybe_bool(strval);
/*
@ -88,10 +88,9 @@ void prepare_repo_settings(struct repository *r)
if (v >= 0)
r->settings.core_untracked_cache = v ?
UNTRACKED_CACHE_WRITE : UNTRACKED_CACHE_REMOVE;
free(strval);
}
if (!repo_config_get_string(r, "fetch.negotiationalgorithm", &strval)) {
if (!repo_config_get_string_tmp(r, "fetch.negotiationalgorithm", &strval)) {
int fetch_default = r->settings.fetch_negotiation_algorithm;
if (!strcasecmp(strval, "skipping"))
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;