]> git.ipfire.org Git - thirdparty/git.git/commit
repository: introduce repo_config_values_clear()
authorTian Yuchen <cat@malon.dev>
Tue, 14 Jul 2026 03:25:16 +0000 (11:25 +0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Jul 2026 14:30:23 +0000 (07:30 -0700)
commit0201d2783e6317c7b76e9c511cbfcfa73fdc17b1
treefceece5a2087d624f0c4cd9c3ee87a1ca53f6d01
parentab776a62a78576513ee121424adb19597fbb7613
repository: introduce repo_config_values_clear()

As part of the ongoing libification effort, dynamically allocated
global configuration variables are being moved into
'struct repo_config_values'. To prevent memory leaks, we need a
destructor to free these heap-allocated variables when a repository
instance is torn down.

Introduce 'repo_config_values_clear()' in environment.c and invoke it
from 'repo_clear()' in repository.c. As a starting point, update this
new function to handle the cleanup of 'attributes_file'.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Mentored-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Tian Yuchen <cat@malon.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
environment.c
environment.h
repository.c