Show More
@@ -991,12 +991,11 b' static int nt_new(nodetree *self)' | |||||
991 | if (self->length == self->capacity) { |
|
991 | if (self->length == self->capacity) { | |
992 | unsigned newcapacity; |
|
992 | unsigned newcapacity; | |
993 | nodetreenode *newnodes; |
|
993 | nodetreenode *newnodes; | |
994 | if (self->capacity >= INT_MAX / (sizeof(nodetreenode) * 2)) { |
|
994 | newcapacity = self->capacity * 2; | |
995 | PyErr_SetString(PyExc_MemoryError, |
|
995 | if (newcapacity >= INT_MAX / sizeof(nodetreenode)) { | |
996 | "overflow in nt_new"); |
|
996 | PyErr_SetString(PyExc_MemoryError, "overflow in nt_new"); | |
997 | return -1; |
|
997 | return -1; | |
998 | } |
|
998 | } | |
999 | newcapacity = self->capacity * 2; |
|
|||
1000 | newnodes = realloc(self->nodes, newcapacity * sizeof(nodetreenode)); |
|
999 | newnodes = realloc(self->nodes, newcapacity * sizeof(nodetreenode)); | |
1001 | if (newnodes == NULL) { |
|
1000 | if (newnodes == NULL) { | |
1002 | PyErr_SetString(PyExc_MemoryError, "out of memory"); |
|
1001 | PyErr_SetString(PyExc_MemoryError, "out of memory"); |
General Comments 0
You need to be logged in to leave comments.
Login now