Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7874d1f

Browse files
committed
Fix NULL dereference in case of out-of-memory condition
1 parent f90a113 commit 7874d1f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Objects/listobject.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,12 @@ list_dealloc(op)
186186
listobject *op;
187187
{
188188
int i;
189-
for (i = 0; i < op->ob_size; i++) {
190-
XDECREF(op->ob_item[i]);
191-
}
192-
if (op->ob_item != NULL)
189+
if (op->ob_item != NULL) {
190+
for (i = 0; i < op->ob_size; i++) {
191+
XDECREF(op->ob_item[i]);
192+
}
193193
free((ANY *)op->ob_item);
194+
}
194195
free((ANY *)op);
195196
}
196197

0 commit comments

Comments
 (0)