[Python-checkins] bpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)

Berker Peksag webhook-mailer at python.org
Wed Aug 22 14:27:36 EDT 2018


https://github.com/python/cpython/commit/c583919ffced0a3b6409766fc12f6e28bef4fac7
commit: c583919ffced0a3b6409766fc12f6e28bef4fac7
branch: master
author: Alexey Izbyshev <izbyshev at ispras.ru>
committer: Berker Peksag <berker.peksag at gmail.com>
date: 2018-08-22T21:27:32+03:00
summary:

bpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)

Reported by Svace static analyzer.

files:
M Modules/_xxsubinterpretersmodule.c

diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 6162c53b9e6f..7b2cda218309 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -15,7 +15,7 @@ _copy_raw_string(PyObject *strobj)
         return NULL;
     }
     char *copied = PyMem_Malloc(strlen(str)+1);
-    if (str == NULL) {
+    if (copied == NULL) {
         PyErr_NoMemory();
         return NULL;
     }



More information about the Python-checkins mailing list