summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-08-13 11:56:57 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2015-08-13 11:56:57 +0200
commite3fa8e88e6807ed787bf859ecdce8e9cf7ce09ee (patch)
tree427407aeb53fc1ddf08198451b4dd32e12930904 /src
parentb9b7ba37e99fd75c7853bf4263faf49b6785e6e6 (diff)
downloadlibuca-e3fa8e88e6807ed787bf859ecdce8e9cf7ce09ee.tar.gz
libuca-e3fa8e88e6807ed787bf859ecdce8e9cf7ce09ee.tar.bz2
libuca-e3fa8e88e6807ed787bf859ecdce8e9cf7ce09ee.tar.xz
libuca-e3fa8e88e6807ed787bf859ecdce8e9cf7ce09ee.zip
Don't free parameters if passes as transfer-none
Diffstat (limited to 'src')
-rw-r--r--src/uca-plugin-manager.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/uca-plugin-manager.c b/src/uca-plugin-manager.c
index 3b62f68..eaf38fb 100644
--- a/src/uca-plugin-manager.c
+++ b/src/uca-plugin-manager.c
@@ -50,6 +50,12 @@ static const gchar *MODULE_PATTERN = "libuca([A-Za-z]+)";
typedef GType (*GetTypeFunc) (void);
+typedef struct {
+ GParameter *p;
+ guint idx;
+} ParamArray;
+
+
/**
* UcaPluginManagerError:
* @UCA_PLUGIN_MANAGER_ERROR_MODULE_NOT_FOUND: The module could not be found
@@ -267,13 +273,6 @@ get_camera_type (UcaPluginManagerPrivate *priv,
*
* Since: 1.7
*/
-typedef struct
-{
- GParameter *p;
- guint idx;
-} ParamArray;
-
-
static void
transform_hash_entry_to_gparameter (gpointer key,
gpointer value,
@@ -307,12 +306,12 @@ uca_plugin_manager_get_camerah (UcaPluginManager *manager,
GHashTable *parameters,
GError **error)
{
- //No parameters. Just create the camera
+ /* No parameters. Just create the camera */
if (!parameters)
return uca_plugin_manager_get_camera (manager, name, error, NULL);
- //If we reach this point, we have parameters. Construct GParameters for them and
- //use uca_plugin_manager_get_camerav to create the camera
+ /* If we reach this point, we have parameters. Construct GParameters for
+ * them and use uca_plugin_manager_get_camerav to create the camera. */
guint n_parameters = g_hash_table_size (parameters);
ParamArray params;
params.p = g_malloc0 (sizeof(GParameter) * n_parameters);
@@ -320,17 +319,7 @@ uca_plugin_manager_get_camerah (UcaPluginManager *manager,
g_hash_table_foreach (parameters, (GHFunc) transform_hash_entry_to_gparameter, &params);
- UcaCamera *camera = uca_plugin_manager_get_camerav(manager, name, n_parameters, params.p, error);
-
- //Free the g_strcpy-ed names
- for (guint i = 0; i < params.idx; i++)
- {
- GParameter *parameter = &(params.p[i]);
- g_free ((gpointer)(parameter->name));
- }
- g_free (params.p);
-
- return camera;
+ return uca_plugin_manager_get_camerav (manager, name, n_parameters, params.p, error);
}
/**