diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2014-04-07 08:34:36 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2014-04-07 08:34:36 +0200 |
commit | f61ebb80f7db6db7653cc4f973d7501d1dfdc071 (patch) | |
tree | 22268d4b3e275e524072e51802c93d80cd827d5f | |
parent | 73dc98c51aafb5cd0491ccf46219fb60a9338ff1 (diff) | |
download | uca-f61ebb80f7db6db7653cc4f973d7501d1dfdc071.tar.gz uca-f61ebb80f7db6db7653cc4f973d7501d1dfdc071.tar.bz2 uca-f61ebb80f7db6db7653cc4f973d7501d1dfdc071.tar.xz uca-f61ebb80f7db6db7653cc4f973d7501d1dfdc071.zip |
Fix some minor memory leaks
-rw-r--r-- | bin/tools/grab.c | 2 | ||||
-rw-r--r-- | src/uca-plugin-manager.c | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/bin/tools/grab.c b/bin/tools/grab.c index 11f8a83..5825ce7 100644 --- a/bin/tools/grab.c +++ b/bin/tools/grab.c @@ -268,6 +268,8 @@ main (int argc, char *argv[]) if (error != NULL) g_print ("Error: %s\n", error->message); + g_option_context_free (context); + cleanup_camera: g_object_unref (camera); diff --git a/src/uca-plugin-manager.c b/src/uca-plugin-manager.c index 9db932a..eb391dd 100644 --- a/src/uca-plugin-manager.c +++ b/src/uca-plugin-manager.c @@ -43,6 +43,7 @@ G_DEFINE_TYPE (UcaPluginManager, uca_plugin_manager, G_TYPE_OBJECT) struct _UcaPluginManagerPrivate { GList *search_paths; + GList *funcs; }; static const gchar *MODULE_PATTERN = "libuca([A-Za-z]+)"; @@ -122,6 +123,9 @@ get_camera_module_paths (const gchar *path) } } + g_dir_close (dir); + g_regex_unref (pattern); + return result; } @@ -149,6 +153,7 @@ transform_camera_module_path_to_name (gchar *path, GList **result) *result = g_list_append (*result, g_match_info_fetch (match_info, 1)); g_match_info_free (match_info); + g_regex_unref (pattern); } static void @@ -250,6 +255,8 @@ get_camera_type (UcaPluginManagerPrivate *priv, return G_TYPE_NONE; } + priv->funcs = g_list_append (priv->funcs, func); + return (*func) (); } @@ -366,8 +373,8 @@ uca_plugin_manager_finalize (GObject *object) { UcaPluginManagerPrivate *priv = UCA_PLUGIN_MANAGER_GET_PRIVATE (object); - g_list_foreach (priv->search_paths, (GFunc) g_free, NULL); - g_list_free (priv->search_paths); + g_list_free_full (priv->search_paths, g_free); + g_list_free_full (priv->funcs, g_free); G_OBJECT_CLASS (uca_plugin_manager_parent_class)->finalize (object); } @@ -392,6 +399,7 @@ uca_plugin_manager_init (UcaPluginManager *manager) manager->priv = priv = UCA_PLUGIN_MANAGER_GET_PRIVATE (manager); priv->search_paths = NULL; + priv->funcs = NULL; uca_camera_path = g_getenv ("UCA_CAMERA_PATH"); |