Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit cefa206

Browse files
authored
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.
1 parent 3dffa71 commit cefa206

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/message.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ static PyObject* PyUpb_Message_MergeInternal(PyObject* self, PyObject* arg,
12081208
if (!serialized) return NULL;
12091209
PyObject* ret = PyUpb_Message_MergeFromString(self, serialized);
12101210
Py_DECREF(serialized);
1211-
Py_DECREF(ret);
1211+
Py_XDECREF(ret);
12121212
Py_RETURN_NONE;
12131213
}
12141214

0 commit comments

Comments
 (0)