Commits

Anonymous committed c4a6d3e

Fix bug #1517, a possible segfault in lookup().

  • Participants
  • Parent commits 52bbe33
  • Branches 2.5

Comments (0)

Files changed (1)

File Objects/dictobject.c

 	else {
 		if (ep->me_hash == hash) {
 			startkey = ep->me_key;
+                        Py_INCREF(startkey);
 			cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
+                        Py_DECREF(startkey);
 			if (cmp < 0)
 				return NULL;
 			if (ep0 == mp->ma_table && ep->me_key == startkey) {
 			return ep;
 		if (ep->me_hash == hash && ep->me_key != dummy) {
 			startkey = ep->me_key;
+                        Py_INCREF(startkey);
 			cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
+                        Py_DECREF(startkey);
 			if (cmp < 0)
 				return NULL;
 			if (ep0 == mp->ma_table && ep->me_key == startkey) {