]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport:
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 25 Jan 2006 05:43:53 +0000 (05:43 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 25 Jan 2006 05:43:53 +0000 (05:43 +0000)
mwh pointed out _Filemodule.c is generated. So to fix the memory leak
this file (the source) must be fixed.

Mac/Modules/file/filesupport.py

index dac706dae05ed38bfafb4e14cd6308cd11245559..50c1d8ae007a5c45fc830e4acdc677701eec01a0 100644 (file)
@@ -255,11 +255,10 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
                 char *path = NULL;
                 if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
                         return NULL;
-                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 */