From: Johannes Sixt Date: Thu, 15 Sep 2011 06:52:55 GMT Subject: Re: [PATCH 2/4] cleanup: use internal memory allocation wrapper functions everywhere Message-ID: <4E71A0C7.8080602@viscovery.net> In-Reply-To: <1316051979-19671-3-git-send-email-drafnel@gmail.com> Am 9/15/2011 3:59, schrieb Brandon Casey: > 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. > > Signed-off-by: Brandon Casey > --- > ... > compat/mingw.c | 2 +- > compat/qsort.c | 2 +- > compat/win32/syslog.c | 2 +- There is a danger that the high-level die() routine (which is used by the x-wrappers) uses one of the low-level compat/ routines. IOW, in the case of errors, recursion might occur. Therefore, I would prefer that the compat/ routines do their own error reporting (preferably via return values and errno). -- Hannes