Commit 4b9dc03d authored by Will Thompson's avatar Will Thompson Committed by Tomeu Vizoso
Browse files

Don't leak when marshalling GErrors to C

Python-land GLib.GErrors are supposed to have three attributes:
"message", "domain" and "code". If those attributes are missing, or they
have the wrong types, the C GError is filled in with a message
describing the error. The present-but-ill-typed code paths did not
DECREF the ill-typed values.
parent adcfe96d
......@@ -363,6 +363,7 @@ pyglib_gerror_exception_check(GError **error)
py_message = PyObject_GetAttrString(value, "message");
if (!py_message || !PYGLIB_PyUnicode_Check(py_message)) {
bad_gerror_message = "gi._glib.GError instances must have a 'message' string attribute";
goto bad_gerror;
......@@ -370,6 +371,7 @@ pyglib_gerror_exception_check(GError **error)
if (!py_domain || !PYGLIB_PyUnicode_Check(py_domain)) {
bad_gerror_message = "gi._glib.GError instances must have a 'domain' string attribute";
goto bad_gerror;
......@@ -378,6 +380,7 @@ pyglib_gerror_exception_check(GError **error)
bad_gerror_message = "gi._glib.GError instances must have a 'code' int attribute";
goto bad_gerror;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment