diff --git a/repository.c b/repository.c index 1a6a62bbd03a5d..468fe580a5d6b6 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;