summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-01-19 12:09:27 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-01-19 12:09:27 (GMT)
commit7874d1fe7e3baa4bde3fbdfea937186061e62516 (patch)
tree98e1aa90d3e6a1158a08b1433de4da475c8749e1 /Objects/listobject.c
parentf90a113176df262aa7d495a57bdc0d09c8ac09bb (diff)
downloadcpython-7874d1fe7e3baa4bde3fbdfea937186061e62516.zip
cpython-7874d1fe7e3baa4bde3fbdfea937186061e62516.tar.gz
cpython-7874d1fe7e3baa4bde3fbdfea937186061e62516.tar.bz2
Fix NULL dereference in case of out-of-memory condition
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 9c9ed75..ecf4645 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -186,11 +186,12 @@ list_dealloc(op)
listobject *op;
{
int i;
- for (i = 0; i < op->ob_size; i++) {
- XDECREF(op->ob_item[i]);
- }
- if (op->ob_item != NULL)
+ if (op->ob_item != NULL) {
+ for (i = 0; i < op->ob_size; i++) {
+ XDECREF(op->ob_item[i]);
+ }
free((ANY *)op->ob_item);
+ }
free((ANY *)op);
}