From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 6 Apr 2018 07:12:38 +0000 (-0700) Subject: bpo-33231: Fix potential leak in normalizestring() (GH-6386) X-Git-Tag: v3.7.0b4~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64421d9237e33725e3c2916cdf2b6d6da1751c2a;p=python bpo-33231: Fix potential leak in normalizestring() (GH-6386) (cherry picked from commit 0c1c4563a65ac451021d927058e4f25013934eb2) Co-authored-by: INADA Naoki --- 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 0000000000..de54fbb526 --- /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 223ccca603..eb3cd35fb8 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -78,8 +78,6 @@ PyObject *normalizestring(const char *string) } p[i] = '\0'; v = PyUnicode_FromString(p); - if (v == NULL) - return NULL; PyMem_Free(p); return v; }