From: Brandon Casey Date: Thu, 15 Sep 2011 15:39:50 GMT Subject: Re: [PATCH 2/4] cleanup: use internal memory allocation wrapper functions everywhere Message-ID: In-Reply-To: <4E71A0C7.8080602@viscovery.net> On Thu, Sep 15, 2011 at 1:52 AM, Johannes Sixt wrote: > 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). Thanks. Will do. -Brandon