From 26acb2cc88d11199f31c0170a924a351276d3a46 Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Tue, 3 Oct 2006 13:04:29 +0000 Subject: [Backport rev. 51669 by brett.cannon] Make sure memory is properly cleaned up in file_init. Backport candidate. --- Misc/NEWS | 4 +++- Objects/fileobject.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 3b8e66d..fb20fa4 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,8 @@ Core and builtins - Bug #1365916: Fix an int/long mismatch in the sorted() built-in. - Fix memory leak of coding spec in Parser/tokenizer.c. + +- Fix memory leak in file_init. - Overflow checking code in integer division ran afoul of new gcc optimizations. Changed to be more standard-conforming. @@ -54,7 +56,7 @@ Core and builtins - Patch #1488312, Fix memory alignment problem on SPARC in unicode -- Fixed a few bugs on cjkcodecs: +- Fixed a few bugs in cjkcodecs: - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly. - iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312 codepoints to conform the standard. diff --git a/Objects/fileobject.c b/Objects/fileobject.c index d7a0694..16499ee 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -1878,7 +1878,7 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds) /* We parse again to get the name as a PyObject */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file", kwlist, &o_name, &mode, &bufsize)) - return -1; + goto Error; if (fill_file_fields(foself, NULL, o_name, mode, fclose) == NULL) -- cgit v0.12