summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index aa43b72..5ac4ac9 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2718,6 +2718,11 @@ _PySequence_BytesToCharpArray(PyObject* self)
for (i = 0; i < argc; ++i) {
char *data;
item = PySequence_GetItem(self, i);
+ if (item == NULL) {
+ /* NULL terminate before freeing. */
+ array[i] = NULL;
+ goto fail;
+ }
data = PyBytes_AsString(item);
if (data == NULL) {
/* NULL terminate before freeing. */