summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-10-18 20:11:40 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-10-18 20:12:04 (GMT)
commitf340a5d363c55d77aca047b6dd85dfaaae02bb6d (patch)
tree65dbf5731b86cb3220fae4bf2669820bf0fa6e06 /src
parente0949633787945ca7ca8b2498f2bbcbf1255ff4b (diff)
Updated the code for the prototypes support.
Diffstat (limited to 'src')
-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;
}