git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] setup.c: reset candidate->work_tree after freeing it
@ 2018-03-30  7:07 Nguyễn Thái Ngọc Duy
  2018-03-30 17:10 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-30  7:07 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy

Dangling pointers are usually bad news. Reset it back to NULL.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.c b/setup.c
index 7287779642..d193bee192 100644
--- a/setup.c
+++ b/setup.c
@@ -482,7 +482,7 @@ static int check_repository_format_gently(const char *gitdir, struct repository_
 			inside_work_tree = -1;
 		}
 	} else {
-		free(candidate->work_tree);
+		FREE_AND_NULL(candidate->work_tree);
 	}
 
 	return 0;
-- 
2.17.0.rc2.408.g9d2a3d914e


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-30 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-30  7:07 [PATCH] setup.c: reset candidate->work_tree after freeing it Nguyễn Thái Ngọc Duy
2018-03-30 17:10 ` Junio C Hamano
2018-03-30 17:41   ` Duy Nguyen
2018-03-30 18:32     ` Junio C Hamano
2018-03-30 19:10       ` Duy Nguyen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).