[Python-Dev] warning in _localemodule.c patch

Martin von Loewis loewis@informatik.hu-berlin.de
Fri, 7 Sep 2001 19:13:17 +0200 (MEST)


> You can't free the memory Py_FSDE points to, since it wasn't
> allocated by malloc().

Why is that? The memory was allocated by strdup in this case, so you
can certainly free() it.

> I guess the simple solution is to remove the const.  Is there a
> better option?

The other option is to cast the pointer in the call to free(). I don't
know which one is better; Py_FSDE certainly points to memory that
should not be changed.

Regards,
Martin