lib: keep plugin name, if any, in component class structure
[babeltrace.git] / src / lib / graph / component-class.c
index 9d7e17b57bbb447b1a8be8d3a19246e515fdf4be..d17dbd4c1c5192fdb22a837351b3eddfb83280f5 100644 (file)
@@ -83,6 +83,11 @@ void destroy_component_class(struct bt_object *obj)
                class->help = NULL;
        }
 
+       if (class->plugin_name) {
+               g_string_free(class->plugin_name, TRUE);
+               class->plugin_name = NULL;
+       }
+
        if (class->destroy_listeners) {
                g_array_free(class->destroy_listeners, TRUE);
                class->destroy_listeners = NULL;
@@ -117,6 +122,12 @@ int bt_component_class_init(struct bt_component_class *class,
                goto error;
        }
 
+       class->plugin_name = g_string_new(NULL);
+       if (!class->plugin_name) {
+               BT_LOGE_STR("Failed to allocate a GString.");
+               goto error;
+       }
+
        class->destroy_listeners = g_array_new(FALSE, TRUE,
                sizeof(struct bt_component_class_destroy_listener));
        if (!class->destroy_listeners) {
This page took 0.025279 seconds and 4 git commands to generate.