Brandon Casey <> writes:

> On Wed, Aug 22, 2012 at 10:41 AM, Johannes Sixt <> wrote:
>> Am 22.08.2012 19:00, schrieb Brandon Casey:
>>>  So I think the body of [compat_mkdir] can become
>>> something like:
>>>    if (len && dir[len-1] == '/')
>>>        dir = tmp_dir = xstrndup(dir, len-1);
>> Don't use x* wrappers in the compat layer, at least not those that
>> allocate memory: They behave unpredictably due to try_to_free_routine
>> and may lead to recursive invocations.
> I thought that rule only applied to die handlers.  i.e. don't use the
> x* wrappers to allocate memory in a die handler like
> compat/win32/syslog.c.  At least that's what I wrote in 040a6551 when
> you pointed out this issue back then.
> Admittedly, it could get pretty sticky trying to trace the die
> handlers to ensure they don't invoke your new compat/ function.  So,
> yeah, adopting this rule of not using x* wrappers that allocate memory
> in compat/ generally seems like a good idea.
> Should we also try to detect recursive invocation of die and friends?

> In theory recursion could be triggered by any die handler that makes
> use of a code path that calls an x* wrapper that allocates memory,
> couldn't it?

Correct, but at that point we will end up dying anyway, so...
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to