diff --git a/repository.c b/repository.c index f988b8ae68a6a2..6b358dd4116ea9 100644 --- a/repository.c +++ b/repository.c @@ -136,7 +136,7 @@ static void repo_set_commondir(struct repository *repo, { struct strbuf sb = STRBUF_INIT; - free(repo->commondir); + FREE_AND_NULL(repo->commondir); if (commondir) { repo->different_commondir = 1;