[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 20:10:29 +0000 (UTC)
commit be8bf820d57fba392e1378ecbd389e9ab0dac6aa
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Fri Oct 15 21:10:22 2010 +0100
Fixed memory leaks
libgnac/libgnac-converter.c | 2 ++
libgnac/libgnac-gst-utils.c | 7 +++----
libgnac/libgnac-output.c | 2 +-
src/gnac-main.c | 15 +++++++++++----
4 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/libgnac/libgnac-converter.c b/libgnac/libgnac-converter.c
index 1ccb0e4..ab16a60 100644
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@ -926,6 +926,8 @@ libgnac_converter_eos_cb(GstBus *bus,
g_signal_emit(converter, signals[FILE_COMPLETED], 0, uri);
+ g_free(uri);
+
/* Start next file conversion */
if (!libgnac_converter_start_next(converter))
{
diff --git a/libgnac/libgnac-gst-utils.c b/libgnac/libgnac-gst-utils.c
index fe9dd3b..1e38363 100644
--- a/libgnac/libgnac-gst-utils.c
+++ b/libgnac/libgnac-gst-utils.c
@@ -90,17 +90,15 @@ libgnac_gstu_bin_add(GstElement *bin,
GstElement *elem,
GError **error)
{
- gchar *name;
-
- name = gst_element_get_name(elem);
-
if (!gst_bin_add(GST_BIN(bin), elem)) {
+ gchar *name = gst_element_get_name(elem);
libgnac_debug("Failed to add %s element to the bin", name);
g_set_error(error,
LIBGNAC_ERROR,
LIBGNAC_ERROR_PIPELINE_CREATION,
_("Failed to add %s element"),
name);
+ g_free(name);
return FALSE;
}
@@ -157,6 +155,7 @@ libgnac_gstu_get_compatible_pad(GstElement *element,
const gchar *type)
{
gchar *pad_name;
+ gchar *sink_pad_name;
GstPad *sink_pad;
pad_name = gst_pad_get_name(pad);
diff --git a/libgnac/libgnac-output.c b/libgnac/libgnac-output.c
index 0c040b8..fd6f5af 100644
--- a/libgnac/libgnac-output.c
+++ b/libgnac/libgnac-output.c
@@ -257,7 +257,7 @@ libgnac_output_replace_pattern(LibgnacRenamePattern *pattern,
if (libgnac_metadata_tag_exists(tags, GNAC_TAG_FILENAME))
{
val = LIBGNAC_METADATA_TAG_FILENAME(tags);
- return g_strdup(libgnac_output_remove_extension(g_value_get_string(val)));
+ return libgnac_output_remove_extension(g_value_get_string(val));
}
return RENAME_PATTERN_DEFAULT_FILENAME;
}
diff --git a/src/gnac-main.c b/src/gnac-main.c
index e1a33d0..0bf2c58 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -349,11 +349,14 @@ gnac_add_files(GSList *files)
void
gnac_add_file(GFile *file)
{
+ gchar *uri;
GError *error = NULL;
GFileInfo *info;
GtkFileFilterInfo filter_info;
- libgnac_debug("Trying to add file %s", g_file_get_uri(file));
+ uri = g_file_get_uri(file);
+ libgnac_debug("Trying to add file %s", uri);
+
info = g_file_query_info(file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &error);
@@ -361,6 +364,7 @@ gnac_add_file(GFile *file)
/* Error adding file */
libgnac_debug("Unable to query file info");
g_clear_error(&error);
+ g_free(uri);
return;
}
@@ -375,10 +379,11 @@ gnac_add_file(GFile *file)
} else if (gtk_file_filter_filter(gnac_ui_get_current_filter(),
&filter_info))
{
- libgnac_info("Add file %s", g_file_get_uri(file));
+ libgnac_info("Add file %s", uri);
libgnac_converter_add(converter, file, &error);
}
}
+ g_free(uri);
g_object_unref(info);
}
@@ -560,10 +565,12 @@ gnac_on_converter_progress_cb(LibgnacConverter *converter,
if (state == GNAC_AUDIO_CONVERT_STATE)
{
gint total;
+ gchar *msg;
g_object_get(G_OBJECT(converter), "nb-files", &total, NULL);
- gnac_ui_push_status(g_strdup_printf(_("Converting file %d of %d"),
- nb_converted, total));
+ msg = g_strdup_printf(_("Converting file %d of %d"), nb_converted, total);
+ gnac_ui_push_status(msg);
+ g_free(msg);
gnac_ui_set_progress_fraction(fraction);
if (prev_time_left != -1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]