Leak fix
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 25 Feb 2016 17:25:39 +0000 (12:25 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 16:57:26 +0000 (12:57 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
converter/babeltrace.c
lib/plugin-system/component-factory.c
lib/plugin-system/component.c

index 78085775533a47b9abda095d9f87a0bf18a6454c..fd025b6c8700f31e3a8d3a80a65cab73f55be814 100644 (file)
@@ -177,6 +177,9 @@ void print_detected_component_classes(struct bt_component_factory *factory)
                                plugin_description ? plugin_description : "None");
                printf_verbose("\tcomponent description: %s\n",
                                component_description ? component_description : "None");
+
+               bt_put(plugin);
+               bt_put(component_class);
        }
 }
 
index 6601a0a619c00b736533379d3b33c4cbcba6a90a..d97eedf6ff5bb091191a3b277d72372093691070 100644 (file)
@@ -122,10 +122,10 @@ bt_component_factory_load_file(struct bt_component_factory *factory,
                goto end;
        }
 
-       factory->current_plugin = plugin;
-       component_status = bt_plugin_register_component_classes(plugin,
-                       factory);
-       factory->current_plugin = NULL;
+       BT_MOVE(factory->current_plugin, plugin);
+       component_status = bt_plugin_register_component_classes(
+                       factory->current_plugin, factory);      
+       BT_PUT(factory->current_plugin);
        if (component_status != BT_COMPONENT_STATUS_OK) {
                switch (component_status) {
                case BT_COMPONENT_STATUS_NOMEM:
@@ -136,7 +136,6 @@ bt_component_factory_load_file(struct bt_component_factory *factory,
                        break;
                }
 
-               BT_PUT(plugin);
                goto end;
        }
 end:
@@ -318,6 +317,7 @@ struct bt_component_class *bt_component_factory_get_component_class(
                if (type != BT_COMPONENT_TYPE_UNKNOWN) {
                        if (type != bt_component_class_get_type(
                                        component_class)) {
+                               bt_put(plugin);
                                continue;
                        }
                }
@@ -328,6 +328,7 @@ struct bt_component_class *bt_component_factory_get_component_class(
 
                        assert(cur_plugin_name);
                        if (strcmp(plugin_name, cur_plugin_name)) {
+                               bt_put(plugin);
                                continue;
                        }
                }
@@ -338,10 +339,12 @@ struct bt_component_class *bt_component_factory_get_component_class(
 
                        assert(cur_cc_name);
                        if (strcmp(component_name, cur_cc_name)) {
+                               bt_put(plugin);
                                continue;
                        }
                }
 
+               bt_put(plugin);
                /* All criteria met. */
                goto match;
        }
index 9c4121ba699dcdc9bb18de053abdf1847d4bd218..16bc28680cd9df654669d2467c7f91bab5e90d6f 100644 (file)
@@ -124,7 +124,6 @@ struct bt_component *bt_component_create(
        }
 
        bt_object_init(component, bt_component_destroy);
-       component->class = bt_get(component_class);
        component->name = g_string_new(name);
        if (!component->name) {
                BT_PUT(component);
This page took 0.026542 seconds and 4 git commands to generate.