This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients ebfe, georg.brandl, ggenellina, loewis, pitrou
Date 2008-12-29.13:31:40
SpamBayes Score 0.0028444882
Marked as misclassified No
Message-id <4958D13A.1090904@v.loewis.de>
In-reply-to <1230554859.14.0.140483399752.issue4746@psf.upfronthosting.co.za>
Content
> Whenever the documentation says "you must not" it really says "don't do
> that or your application *will* crash, burn and die"... Of course I can
> allocate storage for the string, copy it's content and then free or -
> nothing will happen. How would it cause a crash - it's my own pointer.

Suppose you do

  char *s = malloc(MAXPATH);
  if (!PyArg_ParseTuple("s", &s))return NULL;
  do_something_with(s);
  free(s);

then your application *will* crash, burn, and die - because s gets
changed in the call; the original malloc result is garbage, and the
free call will likely crash the malloc implementation (as the block
it points to wasn't malloc-allocated, and isn't the beginning of a
block).
History
Date User Action Args
2008-12-29 13:31:41loewissetrecipients: + loewis, georg.brandl, ggenellina, pitrou, ebfe
2008-12-29 13:31:41loewislinkissue4746 messages
2008-12-29 13:31:40loewiscreate