aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-type.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-type.c')
-rw-r--r--gdb/python/py-type.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index ef658df..b901255 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -101,6 +101,7 @@ static void
field_dealloc (PyObject *obj)
{
field_object *f = (field_object *) obj;
+
Py_XDECREF (f->dict);
f->ob_type->tp_free (obj);
}
@@ -109,6 +110,7 @@ static PyObject *
field_new (void)
{
field_object *result = PyObject_New (field_object, &field_object_type);
+
if (result)
{
result->dict = PyDict_New ();
@@ -128,6 +130,7 @@ static PyObject *
typy_get_code (PyObject *self, void *closure)
{
struct type *type = ((type_object *) self)->type;
+
return PyInt_FromLong (TYPE_CODE (type));
}
@@ -222,6 +225,7 @@ typy_fields (PyObject *self, PyObject *args)
for (i = 0; i < TYPE_NFIELDS (type); ++i)
{
PyObject *dict = convert_field (type, i);
+
if (!dict)
{
Py_DECREF (result);
@@ -243,6 +247,7 @@ static PyObject *
typy_get_tag (PyObject *self, void *closure)
{
struct type *type = ((type_object *) self)->type;
+
if (!TYPE_TAG_NAME (type))
Py_RETURN_NONE;
return PyString_FromString (TYPE_TAG_NAME (type));
@@ -439,6 +444,7 @@ typy_lookup_typename (char *type_name, struct block *block)
{
struct type *type = NULL;
volatile struct gdb_exception except;
+
TRY_CATCH (except, RETURN_MASK_ALL)
{
if (!strncmp (type_name, "struct ", 7))
@@ -675,6 +681,7 @@ typy_dealloc (PyObject *obj)
{
/* Must reset head of list. */
struct objfile *objfile = TYPE_OBJFILE (type->type);
+
if (objfile)
set_objfile_data (objfile, typy_objfile_data_key, type->next);
}