[Python-checkins] r46253 - python/trunk/Python/pystrtod.c

Tim Peters tim.peters at gmail.com
Thu May 25 22:48:49 CEST 2006


> Author: brett.cannon
> Date: Thu May 25 22:44:08 2006
> New Revision: 46253
>
> Modified:
>    python/trunk/Python/pystrtod.c
> Log:
> Swap out bare malloc()/free() use for PyMem_MALLOC()/PyMem_FREE() .
>
>
> Modified: python/trunk/Python/pystrtod.c
> ==============================================================================
> --- python/trunk/Python/pystrtod.c      (original)
> +++ python/trunk/Python/pystrtod.c      Thu May 25 22:44:08 2006
> @@ -101,7 +101,7 @@
>                 char *copy, *c;
>
>                 /* We need to convert the '.' to the locale specific decimal point */
> -               copy = (char *)malloc(end - nptr + 1 + decimal_point_len);
> +               copy = (char *)PyMem_MALLOC(end - nptr + 1 + decimal_point_len);
>
>                 c = copy;
>                 memcpy(c, nptr, decimal_point_pos - nptr);

Note that this missed a genuine (but pre-existing) bug:  we can't
_assume_ malloc (of any flavor) returns a non-NULL pointer.


More information about the Python-checkins mailing list