C Wrapper Function, crashing Python?
Java and Swing
codecraig at gmail.com
Wed Oct 12 12:15:52 EDT 2005
thanks for the tip, however even when I do not free aString or bString,
i'm still crashing at the malloc in the c function, not the wrapper.
Bernhard Herzog wrote:
> "Java and Swing" <codecraig at gmail.com> writes:
>
> > static PyObject *wrap_doStuff(PyObject *self, PyObject *args) {
> [...]
> > char *aString = 0;
> > char *bString = 0;
> [...]
> > int ok = PyArg_ParseTuple(args, "sss", &in, &aString, &bString);
> [...]
> > free(aString);
> > free(bString);
>
> aString and bString are pointers to memory managed by the strings in
> your args tuple. You must not free them! The memory is automatically
> managed by Python.
>
> Bernhard
>
> --
> Intevation GmbH http://intevation.de/
> Skencil http://skencil.org/
> Thuban http://thuban.intevation.org/
More information about the Python-list
mailing list