summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/types/proto.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/analysis/types/proto.c b/src/analysis/types/proto.c
index 17f0262..8d5b897 100644
--- a/src/analysis/types/proto.c
+++ b/src/analysis/types/proto.c
@@ -232,12 +232,14 @@ static GDataType *g_proto_type_dup(const GProtoType *type)
{
ret_type = g_data_type_dup(type->ret_type);
g_proto_type_set_return_type(result, ret_type);
+ g_object_unref(G_OBJECT(ret_type));
}
for (i = 0; i < type->count; i++)
{
arg = g_data_type_dup(type->args[i]);
g_proto_type_add_arg(result, arg);
+ g_object_unref(G_OBJECT(arg));
}
return G_DATA_TYPE(result);
@@ -363,7 +365,14 @@ void g_proto_type_set_return_type(GProtoType *type, GDataType *ret)
if (type->ret_type != NULL)
g_object_unref(G_OBJECT(type->ret_type));
- type->ret_type = ret;
+ if (ret == NULL)
+ type->ret_type = NULL;
+
+ else
+ {
+ g_object_ref(G_OBJECT(ret));
+ type->ret_type = ret;
+ }
}
@@ -409,7 +418,9 @@ GDataType *g_proto_type_get_return_type(const GProtoType *type)
void g_proto_type_add_arg(GProtoType *type, GDataType *arg)
{
- type->args = (GDataType **)realloc(type->args, ++type->count * sizeof(GDataType *));
+ g_object_ref(G_OBJECT(arg));
+
+ type->args = realloc(type->args, ++type->count * sizeof(GDataType *));
type->args[type->count - 1] = arg;
}