[Python-Dev] [Python-checkins] cpython: avoid unitialized memory

Stefan Krah stefan at bytereef.org
Fri May 4 11:39:51 CEST 2012


benjamin.peterson <python-checkins at python.org> wrote:
> summary:
>   avoid unitialized memory
> 
> diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
> --- a/Modules/posixmodule.c
> +++ b/Modules/posixmodule.c
> @@ -3576,7 +3576,7 @@
>  split_py_long_to_s_and_ns(PyObject *py_long, time_t *s, long *ns)
>  {
>      int result = 0;
> -    PyObject *divmod;
> +    PyObject *divmod = NULL;
>      divmod = PyNumber_Divmod(py_long, billion);
>      if (!divmod)
>          goto exit;

If I'm not mistaken, divmod was already unconditionally initialized
by PyNumber_Divmod().


Stefan Krah




More information about the Python-Dev mailing list