summaryrefslogtreecommitdiffstats
path: root/Modules/_csv.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-14 20:29:34 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-14 20:29:34 (GMT)
commitb80b37868069fc5ff459f41565163c417fa3cf12 (patch)
treed64bd7e9f648e22bfed9e1b35c9f978d5ca9fa4e /Modules/_csv.c
parent1eadd6a120d7f475cc4d2567087d27e7a196c6ca (diff)
downloadcpython-b80b37868069fc5ff459f41565163c417fa3cf12.zip
cpython-b80b37868069fc5ff459f41565163c417fa3cf12.tar.gz
cpython-b80b37868069fc5ff459f41565163c417fa3cf12.tar.bz2
Issue #19437: Fix parse_save_field() of the csv module, handle PyList_Append()
failure
Diffstat (limited to 'Modules/_csv.c')
-rw-r--r--Modules/_csv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 22ac266..183a9a5 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -546,7 +546,10 @@ parse_save_field(ReaderObj *self)
return -1;
field = tmp;
}
- PyList_Append(self->fields, field);
+ if (PyList_Append(self->fields, field) < 0) {
+ Py_DECREF(field);
+ return -1;
+ }
Py_DECREF(field);
return 0;
}