[Python-checkins] bpo-33231: Fix potential leak in normalizestring() (GH-6386)

Miss Islington (bot) webhook-mailer at python.org
Fri Apr 6 03:37:07 EDT 2018


https://github.com/python/cpython/commit/2350a4765265158072bf7ad9f04402406d3d1ada
commit: 2350a4765265158072bf7ad9f04402406d3d1ada
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-04-06T00:37:03-07:00
summary:

bpo-33231: Fix potential leak in normalizestring() (GH-6386)

(cherry picked from commit 0c1c4563a65ac451021d927058e4f25013934eb2)

Co-authored-by: INADA Naoki <methane at users.noreply.github.com>

files:
A Misc/NEWS.d/next/Core and Builtins/2018-04-05-22-20-44.bpo-33231.3Jmo0q.rst
M Python/codecs.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-04-05-22-20-44.bpo-33231.3Jmo0q.rst b/Misc/NEWS.d/next/Core and Builtins/2018-04-05-22-20-44.bpo-33231.3Jmo0q.rst
new file mode 100644
index 000000000000..de54fbb52671
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2018-04-05-22-20-44.bpo-33231.3Jmo0q.rst	
@@ -0,0 +1 @@
+Fix potential memory leak in ``normalizestring()``.
diff --git a/Python/codecs.c b/Python/codecs.c
index fe57d0dc42d4..4ff83014d8bc 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -77,8 +77,6 @@ PyObject *normalizestring(const char *string)
     }
     p[i] = '\0';
     v = PyUnicode_FromString(p);
-    if (v == NULL)
-        return NULL;
     PyMem_Free(p);
     return v;
 }



More information about the Python-checkins mailing list