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 <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
97410b27e9
commit
040a655116
@ -1183,7 +1183,7 @@ static int WSAAPI getaddrinfo_stub(const char *node, const char *service,
|
||||
}
|
||||
ai->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
if (hints && (hints->ai_flags & AI_CANONNAME))
|
||||
ai->ai_canonname = h ? strdup(h->h_name) : NULL;
|
||||
ai->ai_canonname = h ? xstrdup(h->h_name) : NULL;
|
||||
else
|
||||
ai->ai_canonname = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user