File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed
Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -200,25 +200,17 @@ int repo_submodule_init(struct repository *submodule,
200200
201201void repo_clear (struct repository * repo )
202202{
203- free (repo -> gitdir );
204- repo -> gitdir = NULL ;
205- free (repo -> commondir );
206- repo -> commondir = NULL ;
207- free (repo -> objectdir );
208- repo -> objectdir = NULL ;
209- free (repo -> graft_file );
210- repo -> graft_file = NULL ;
211- free (repo -> index_file );
212- repo -> index_file = NULL ;
213- free (repo -> worktree );
214- repo -> worktree = NULL ;
215- free (repo -> submodule_prefix );
216- repo -> submodule_prefix = NULL ;
203+ FREE_AND_NULL (repo -> gitdir );
204+ FREE_AND_NULL (repo -> commondir );
205+ FREE_AND_NULL (repo -> objectdir );
206+ FREE_AND_NULL (repo -> graft_file );
207+ FREE_AND_NULL (repo -> index_file );
208+ FREE_AND_NULL (repo -> worktree );
209+ FREE_AND_NULL (repo -> submodule_prefix );
217210
218211 if (repo -> config ) {
219212 git_configset_clear (repo -> config );
220- free (repo -> config );
221- repo -> config = NULL ;
213+ FREE_AND_NULL (repo -> config );
222214 }
223215
224216 if (repo -> submodule_cache ) {
@@ -228,8 +220,7 @@ void repo_clear(struct repository *repo)
228220
229221 if (repo -> index ) {
230222 discard_index (repo -> index );
231- free (repo -> index );
232- repo -> index = NULL ;
223+ FREE_AND_NULL (repo -> index );
233224 }
234225}
235226
You can’t perform that action at this time.
0 commit comments