Fix `PyUpb_Message_MergeInternal` segfault (#1338)

when `PyUpb_Message_MergeFromString` returns `NULL`, currently
`PyUpb_Message_MergeInternal` will call `Py_DECREF` on `NULL`
which results in a segmentation fault.

This patch switches to `Py_XDECREF` to fix the segfault.
pull/13908/head
messense 2 years ago committed by Adam Cozzette
parent 2a5724d86e
commit ccadaf3196
  1. 2
      upb/python/message.c

@ -1216,7 +1216,7 @@ static PyObject* PyUpb_Message_MergeInternal(PyObject* self, PyObject* arg,
if (!serialized) return NULL;
PyObject* ret = PyUpb_Message_MergeFromString(self, serialized);
Py_DECREF(serialized);
Py_DECREF(ret);
Py_XDECREF(ret);
Py_RETURN_NONE;
}

Loading…
Cancel
Save