[gnac/devel] Fixed memory leaks
- From: Benoît Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/devel] Fixed memory leaks
- Date: Fri, 15 Oct 2010 19:37:45 +0000 (UTC)
commit 8cd472b49e431fa1a35a9b960754d4bd60eb19f3
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Fri Oct 15 20:37:27 2010 +0100
Fixed memory leaks
libgnac/libgnac-converter.c | 12 ++++++++++++
libgnac/libgnac-converter.h | 3 +++
libgnac/libgnac-media-item.c | 3 +--
libgnac/libgnac-output.c | 12 ++++++++----
src/gnac-ui.c | 2 ++
5 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/libgnac/libgnac-converter.c b/libgnac/libgnac-converter.c
index ee6e908..1ccb0e4 100644
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@ -654,6 +654,7 @@ libgnac_converter_new(LibgnacMetadata *mdata)
return g_object_new(LIBGNAC_TYPE_CONVERTER, NULL);
}
+
LibgnacOutputConfig *
libgnac_converter_get_config(LibgnacConverter *self)
{
@@ -671,6 +672,17 @@ libgnac_converter_get_config(LibgnacConverter *self)
void
+libgnac_converter_free_config(LibgnacOutputConfig *config)
+{
+ g_free(config->extension);
+ g_free(config->folder_hierarchy);
+ g_free(config->folder_path);
+ g_free(config->rename_pattern);
+ g_free(config);
+}
+
+
+void
libgnac_converter_add(LibgnacConverter *self,
GFile *file,
GError **error)
diff --git a/libgnac/libgnac-converter.h b/libgnac/libgnac-converter.h
index f00127e..9aa4373 100644
--- a/libgnac/libgnac-converter.h
+++ b/libgnac/libgnac-converter.h
@@ -94,6 +94,9 @@ libgnac_converter_get_type(void);
LibgnacOutputConfig *
libgnac_converter_get_config(LibgnacConverter *self);
+void
+libgnac_converter_free_config(LibgnacOutputConfig *config);
+
GObject *
libgnac_converter_new(LibgnacMetadata *mdata);
diff --git a/libgnac/libgnac-media-item.c b/libgnac/libgnac-media-item.c
index d79205b..a3fe1fe 100644
--- a/libgnac/libgnac-media-item.c
+++ b/libgnac/libgnac-media-item.c
@@ -83,8 +83,7 @@ libgnac_item_build(LibgnacMediaItem *item,
}
item->destination = libgnac_output_build_output(item->source, config, &err);
- // TODO free config->*
- g_free(config);
+ libgnac_converter_free_config(config);
if (err) {
libgnac_warning("Output creation failed");
diff --git a/libgnac/libgnac-output.c b/libgnac/libgnac-output.c
index eaf838e..0c040b8 100644
--- a/libgnac/libgnac-output.c
+++ b/libgnac/libgnac-output.c
@@ -404,7 +404,8 @@ libgnac_output_build_output(GFile *source,
g_return_val_if_fail(!error || !*error, NULL);
- filename = libgnac_output_get_filename(source, config->rename_pattern, &output_error);
+ filename = libgnac_output_get_filename(source, config->rename_pattern,
+ &output_error);
if (output_error) {
libgnac_debug("Filename creation failed");
g_propagate_error(error, output_error);
@@ -441,10 +442,12 @@ libgnac_output_build_output(GFile *source,
{
/* replace all known patterns by their value */
g_slist_foreach(rename_patterns,
- (GFunc)libgnac_output_rename_pattern_process, &(config->folder_hierarchy));
+ (GFunc)libgnac_output_rename_pattern_process,
+ &(config->folder_hierarchy));
/* build the output filename */
- output_name = g_strdup_printf("%s%c%s.%s",
- config->folder_hierarchy, G_DIR_SEPARATOR, filename, config->extension);
+ output_name = g_strdup_printf("%s%c%s.%s",
+ config->folder_hierarchy, G_DIR_SEPARATOR, filename,
+ config->extension);
}
else
{
@@ -458,6 +461,7 @@ libgnac_output_build_output(GFile *source,
destination = g_file_get_child(out_directory, sanitized);
/* cleanup */
+ g_object_unref(out_directory);
g_free(output_name);
g_free(sanitized);
g_free(filename);
diff --git a/src/gnac-ui.c b/src/gnac-ui.c
index 21618fc..bc5b5a1 100644
--- a/src/gnac-ui.c
+++ b/src/gnac-ui.c
@@ -977,6 +977,8 @@ gnac_ui_destroy(void)
g_object_unref(gnac_main_builder);
gnac_main_builder = NULL;
}
+
+ g_free(status_msg);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]