[Python-checkins] r42149 - python/trunk/Mac/Modules/file/_Filemodule.c

Michael Hudson mwh at python.net
Tue Jan 24 17:29:11 CET 2006


"neal.norwitz" <python-checkins at python.org> writes:

> Author: neal.norwitz
> Date: Mon Jan 23 08:25:29 2006
> New Revision: 42149
>
> Modified:
>    python/trunk/Mac/Modules/file/_Filemodule.c
> Log:
> This should fix a mem leak on the Mac.  Brett tested it.
>
> Modified: python/trunk/Mac/Modules/file/_Filemodule.c
> ==============================================================================
> --- python/trunk/Mac/Modules/file/_Filemodule.c	(original)
> +++ python/trunk/Mac/Modules/file/_Filemodule.c	Mon Jan 23 08:25:29 2006
> @@ -3204,11 +3204,10 @@
>                  char *path = NULL;
>                  if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
>                          return 0;
> -                if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
> +                if ( (err=FSPathMakeRef(path, fsr, NULL)) )
>                          PyMac_Error(err);
> -                        return 0;
> -                }
> -                return 1;
> +                PyMem_Free(path);
> +                return !err;
>          }
>          /* XXXX Should try unicode here too */
>          /* Otherwise we try to go via an FSSpec */

Isn't this file autogenerated?  I think you probably want to make the
same change in filesupport.py.

Cheers,
mwh

-- 
31. Simplicity does not precede complexity, but follows it.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html


More information about the Python-checkins mailing list