[ltt-dev] [UST PATCH 1/5] Make app socket directories per-user

Nils Carlson nils.carlson at ludd.ltu.se
Tue Mar 29 13:44:06 EDT 2011


On Mar 29, 2011, at 6:03 PM, Mathieu Desnoyers wrote:

> * Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote:
>> * Nils Carlson (nils.carlson at ericsson.com) wrote:
> [...]
>> Please document that the caller must free the char * returned.
>>
>>> +char *ustcomm_user_sock_dir(void)
>>> +{
>
> Actually, thinking about it a little more, we should probably even  
> use a
> naming convention that tells us we need to free memory returned by the
> function return value pointer everywhere so that we can audit the  
> caller
> code easily for missing "free()".
>
> e.g., in this case:
>
> char *ustcomm_alloc_user_sock_dir(void)
>
> Thoughts ?
>

Well, I agree that this can be a good principle, especially for  
structs, but I think
that for (char *) this is overkill. If something returns a (char *)  
you expect it
to allocate memory, unless it explicitly states that it doesn't.

But documenting is good.

/Nils



> Thanks,
>
> Mathieu
>
> -- 
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev





More information about the lttng-dev mailing list