[docs] Memory leak in sample "Noddy" extension module code
georg at python.org
Sat Sep 17 20:18:55 CEST 2011
-----BEGIN PGP SIGNED MESSAGE-----
Am 12.09.2011 16:51, schrieb Paul Koning:
> There's a memory leak in the sample code for the Noddy extension module in
> the "Extending and Embedding" manual for 2.7.2. Consider for example
> section 2.1.2, page 36 in the US page size PDF file, function
> There are two places where Py_DECREF(format) is needed, and both are
> missing. One is in the error handler for the creation of the "args" object.
> The other is after the call to PyString_Format(format,args).
> The error is repeated a couple of times in the assorted variants of the
> Noddy module example.
I think the examples are correct: "format" is declared static and only
initialized once per process. Therefore it shouldn't be decref'd.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the docs