bpo-32436: Fix potential NULL dereference (#5286)

This commit is contained in:
Yury Selivanov 2018-01-23 16:26:07 -05:00 committed by GitHub
parent 9d411c119f
commit 0bad4d63c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1055,6 +1055,10 @@ hamt_node_bitmap_without(PyHamtNode_Bitmap *self,
#endif #endif
PyHamtNode_Bitmap *clone = hamt_node_bitmap_clone(self); PyHamtNode_Bitmap *clone = hamt_node_bitmap_clone(self);
if (clone == NULL) {
return W_ERROR;
}
Py_SETREF(clone->b_array[val_idx], Py_SETREF(clone->b_array[val_idx],
(PyObject *)sub_node); /* borrow */ (PyObject *)sub_node); /* borrow */