]> granicus.if.org Git - python/commitdiff
Commit memory leaking fix.
authorGeorg Brandl <georg@python.org>
Sun, 25 Sep 2005 06:16:40 +0000 (06:16 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 25 Sep 2005 06:16:40 +0000 (06:16 +0000)
Modules/posixmodule.c

index 183e02af87ffddefbb9a69da7cce8769a8fe508e..6f771595feae01b2440d0a4194620c57b56b2426 100644 (file)
@@ -7255,8 +7255,12 @@ win32_startfile(PyObject *self, PyObject *args)
        Py_BEGIN_ALLOW_THREADS
        rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL);
        Py_END_ALLOW_THREADS
-       if (rc <= (HINSTANCE)32)
-               return win32_error("startfile", filepath);
+       if (rc <= (HINSTANCE)32) {
+               PyObject *errval = win32_error("startfile", filepath);
+               PyMem_Free(filepath);
+               return errval;
+       }
+       PyMem_Free(filepath);
        Py_INCREF(Py_None);
        return Py_None;
 }