[SSSD] [PATCH] NSS: replace with space with specified character in names.

Jakub Hrozek jhrozek at redhat.com
Fri Jul 25 09:18:59 UTC 2014


On Fri, Jul 25, 2014 at 10:51:27AM +0200, Pavel Reichl wrote:
> >>+    tmp_ctx = talloc_new(mem_ctx);
> Is there any difference in creation of  tmp_ctx on NULL and on mem_ctx int
> this case? I guess as long as you steal result from tmp_ctx and then free
> tmp_ctx  it doesn't really matter, right? I guess it's just more usual to
> allocate on NULL in utility function.

We keep having discussions about this topic periodically :)

I personally prefer allocating on NULL for purely utility functions
where you have no idea who the caller is, purely because it's easy to
detect leaks with valgrind.

However, if the utility function is used as part of a request that is
guaranteed to end, I think it's OK (and actually should be preferred)
to allocate tmp_ctx on some existing context (like state or req in tevent
requests). That way, even if you forget to free tmp_ctx, the memory will
be gone when the request finishes.



More information about the sssd-devel mailing list