On Mon, Nov 26, 2012 at 05:52:53PM +0100, Pavel Březina wrote:
In general, I think freeing const variable means that something is
wrong with design, although I found myself in this situation once or
twice (in other projects).
I don't think this is necessarily true; we often use a construct such
as:
const char *str;
str = talloc_asprintf("%s%s\n", foo, bar);
/* do stuff while treating str as const */
talloc_free(str);
The free above would produce a warning with glibc's free, but I think
if talloc discarded const here, we might get code that even treats str
as const, but is able to free str.
To me, the patch makes sense.