diff options
Diffstat (limited to 'src/analysis/contents')
-rw-r--r-- | src/analysis/contents/encapsulated.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/analysis/contents/encapsulated.c b/src/analysis/contents/encapsulated.c index e307e6b..74795ea 100644 --- a/src/analysis/contents/encapsulated.c +++ b/src/analysis/contents/encapsulated.c @@ -225,11 +225,9 @@ static void g_encaps_content_interface_init(GBinContentInterface *iface) static void g_encaps_content_dispose(GEncapsContent *content) { - if (content->base != NULL) - g_object_unref(content->base); + g_clear_object(&content->base); - if (content->endpoint != NULL) - g_object_unref(content->endpoint); + g_clear_object(&content->endpoint); G_OBJECT_CLASS(g_encaps_content_parent_class)->dispose(G_OBJECT(content)); @@ -281,6 +279,9 @@ GBinContent *g_encaps_content_new(GBinContent *base, const char *path, GBinConte result = g_object_new(G_TYPE_ENCAPS_CONTENT, NULL); + g_object_ref(base); + g_object_ref(endpoint); + result->base = base; result->path = strdup(path); result->endpoint = endpoint; @@ -349,10 +350,12 @@ GBinContent *g_encaps_content_new_from_xml(xmlXPathContextPtr context, const cha endpoint = NULL;/// TODO if (endpoint != NULL) + { result = g_encaps_content_new(original, target, endpoint); + g_object_unref(G_OBJECT(endpoint)); + } - else - g_object_unref(G_OBJECT(original)); + g_object_unref(G_OBJECT(original)); } else |