From 040a655116c9755bbf30acd22c34eecb2f502c6d Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 6 Oct 2011 13:22:22 -0500 Subject: cleanup: use internal memory allocation wrapper functions everywhere The "x"-prefixed versions of strdup, malloc, etc. will check whether the allocation was successful and terminate the process otherwise. A few uses of malloc were left alone since they already implemented a graceful path of failure or were in a quasi external library like xdiff. Additionally, the call to malloc in compat/win32/syslog.c was not modified since the syslog() implemented there is a die handler and a call to the x-wrappers within a die handler could result in recursion should memory allocation fail. This will have to be addressed separately. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'attr.c') diff --git a/attr.c b/attr.c index fe38fcc36b..0793859b71 100644 --- a/attr.c +++ b/attr.c @@ -533,7 +533,7 @@ static void bootstrap_attr_stack(void) if (!is_bare_repository() || direction == GIT_ATTR_INDEX) { elem = read_attr(GITATTRIBUTES_FILE, 1); - elem->origin = strdup(""); + elem->origin = xstrdup(""); elem->prev = attr_stack; attr_stack = elem; debug_push(elem); -- cgit v1.2.3