]> granicus.if.org Git - python/commitdiff
bpo-33231: Fix potential leak in normalizestring() (GH-6386)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 6 Apr 2018 07:37:03 +0000 (00:37 -0700)
committerGitHub <noreply@github.com>
Fri, 6 Apr 2018 07:37:03 +0000 (00:37 -0700)
(cherry picked from commit 0c1c4563a65ac451021d927058e4f25013934eb2)

Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
Misc/NEWS.d/next/Core and Builtins/2018-04-05-22-20-44.bpo-33231.3Jmo0q.rst [new file with mode: 0644]
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 (file)
index 0000000..de54fbb
--- /dev/null
@@ -0,0 +1 @@
+Fix potential memory leak in ``normalizestring()``.
index fe57d0dc42d42d974deff748ffee30020f1cdcbf..4ff83014d8bc82f091c780bb7eac9b88fbac3f28 100644 (file)
@@ -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;
 }