From: Jack Jansen Date: Thu, 19 Jan 1995 12:09:27 +0000 (+0000) Subject: Fix NULL dereference in case of out-of-memory condition X-Git-Tag: v1.2b3~148 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7874d1fe7e3baa4bde3fbdfea937186061e62516;p=thirdparty%2FPython%2Fcpython.git Fix NULL dereference in case of out-of-memory condition --- diff --git a/Objects/listobject.c b/Objects/listobject.c index 9c9ed7593b5b..ecf46457d9ef 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); }