Revision: 1550
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1550&view=rev
Author: jcsjcs
Date: 2007-06-17 07:14:38 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
* src/info.c (gtkpod_statusbar_message): fixed memory leak --
thanks to Daniele Forsi.
* src/display_sorttabs.c (st_create_special): fixed memory
leak.
* src/prefs.c (init_prefs): fixed memory leak.
* src/syncdir.c (sync_playlist): fixed memory leak.
* src/display_coverart.c (coverart_block_change): fixed memory
leak.
Modified Paths:
--------------
gtkpod/trunk/ChangeLog_detailed
gtkpod/trunk/src/display_coverart.c
gtkpod/trunk/src/display_sorttabs.c
gtkpod/trunk/src/file_itunesdb.c
gtkpod/trunk/src/info.c
gtkpod/trunk/src/prefs.c
gtkpod/trunk/src/syncdir.c
Modified: gtkpod/trunk/ChangeLog_detailed
===================================================================
--- gtkpod/trunk/ChangeLog_detailed 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/ChangeLog_detailed 2007-06-17 14:14:38 UTC (rev 1550)
@@ -1,3 +1,18 @@
+2007-06-17 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+ * src/info.c (gtkpod_statusbar_message): fixed memory leak --
+ thanks to Daniele Forsi.
+
+ * src/display_sorttabs.c (st_create_special): fixed memory
+ leak.
+
+ * src/prefs.c (init_prefs): fixed memory leak.
+
+ * src/syncdir.c (sync_playlist): fixed memory leak.
+
+ * src/display_coverart.c (coverart_block_change): fixed memory
+ leak.
+
2007-06-14 Jorg Schuler <jcsjcs at users.sourceforge.net>
* po/es.po: new version updated by Alejandro Lamas DaviƱa.
Modified: gtkpod/trunk/src/display_coverart.c
===================================================================
--- gtkpod/trunk/src/display_coverart.c 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/src/display_coverart.c 2007-06-17 14:14:38 UTC (rev 1550)
@@ -1857,14 +1857,18 @@
{
if (GTK_WIDGET_REALIZED(gtkpod_window))
{
- if (val)
- gdk_window_set_cursor (gtkpod_window->window,
gdk_cursor_new (GDK_WATCH));
- else
- gdk_window_set_cursor (gtkpod_window->window, NULL);
- }
-
- if (cdwidget != NULL)
- cdwidget->block_display_change = val;
+ if (val)
+ {
+ GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
+ gdk_window_set_cursor (gtkpod_window->window, cursor);
+ gdk_cursor_unref (cursor);
+ }
+ else
+ gdk_window_set_cursor (gtkpod_window->window, NULL);
+ }
+
+ if (cdwidget != NULL)
+ cdwidget->block_display_change = val;
}
/**
Modified: gtkpod/trunk/src/display_sorttabs.c
===================================================================
--- gtkpod/trunk/src/display_sorttabs.c 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/src/display_sorttabs.c 2007-06-17 14:14:38 UTC (rev 1550)
@@ -2841,7 +2841,6 @@
"clicked",
G_CALLBACK (on_sp_cal_button_clicked),
GUINT_TO_POINTER((T_TIME_PLAYED<<SP_SHIFT) + inst));
-
g_free(buf);
/* MODIFIED */
@@ -2866,7 +2865,6 @@
"clicked",
G_CALLBACK (on_sp_cal_button_clicked),
GUINT_TO_POINTER((T_TIME_MODIFIED<<SP_SHIFT) + inst));
-
g_free(buf);
/* ADDED */
@@ -2902,6 +2900,7 @@
GINT_TO_POINTER(inst));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
prefs_get_int_index("sp_autodisplay", inst));
+ g_free (buf);
/* Safe pointer to tooltips */
st->sp_tooltips_data = gtk_tooltips_data_get(gtkpod_xml_get_widget
(special_xml, "sp_modified_entry"));
Modified: gtkpod/trunk/src/file_itunesdb.c
===================================================================
--- gtkpod/trunk/src/file_itunesdb.c 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/src/file_itunesdb.c 2007-06-17 14:14:38 UTC (rev 1550)
@@ -220,7 +220,7 @@
/* Return TRUE on success, FALSE otherwise */
static gboolean read_extended_info (gchar *name, gchar *itunes)
{
- gchar *sha1, buf[PATH_MAX], *arg, *line, *bufp;
+ gchar *sha1, buf[PATH_MAX];
gboolean success = TRUE;
gboolean expect_hash, hash_matched=FALSE;
gint len;
@@ -247,6 +247,8 @@
expect_hash = TRUE; /* next we expect the hash value (checksum) */
while (success && fgets (buf, PATH_MAX, fp))
{
+ gchar *line, *arg, *bufp;
+
/* allow comments */
if ((buf[0] == ';') || (buf[0] == '#')) continue;
arg = strchr (buf, '=');
@@ -283,102 +285,104 @@
{
gtkpod_warning (_("%s:\nExpected \"itunesdb_hash=\" but
got:\"%s\"\n"), name, buf);
success = FALSE;
+ g_free (line);
break;
}
}
- else
- if(g_ascii_strcasecmp (line, "id") == 0)
- { /* found new id */
- if (sei)
- {
- if (sei->ipod_id != 0)
- { /* normal extended information */
- if (hash_matched)
+ else if(g_ascii_strcasecmp (line, "id") == 0)
+ { /* found new id */
+ if (sei)
+ {
+ if (sei->ipod_id != 0)
+ { /* normal extended information */
+ if (hash_matched)
+ {
+ if (!extendedinfohash)
{
- if (!extendedinfohash)
- {
- extendedinfohash = g_hash_table_new_full (
- g_int_hash,g_int_equal, NULL,hash_delete);
- }
- g_hash_table_insert (extendedinfohash,
- &sei->ipod_id, sei);
+ extendedinfohash = g_hash_table_new_full (
+ g_int_hash,g_int_equal, NULL,hash_delete);
}
- else if (sei->sha1_hash)
+ g_hash_table_insert (extendedinfohash,
+ &sei->ipod_id, sei);
+ }
+ else if (sei->sha1_hash)
+ {
+ if (!extendedinfohash_sha1)
{
- if (!extendedinfohash_sha1)
- {
- extendedinfohash_sha1 = g_hash_table_new_full (
- g_str_hash,g_str_equal, NULL,hash_delete);
- }
- g_hash_table_insert (extendedinfohash_sha1,
- sei->sha1_hash, sei);
+ extendedinfohash_sha1 = g_hash_table_new_full (
+ g_str_hash,g_str_equal, NULL,hash_delete);
}
- else
- {
- hash_delete ((gpointer)sei);
- }
+ g_hash_table_insert (extendedinfohash_sha1,
+ sei->sha1_hash, sei);
}
else
- { /* this is a deleted track that hasn't yet been
- removed from the iPod's hard drive */
- Track *track = gp_track_new ();
- track->ipod_path = g_strdup (sei->ipod_path);
- extendeddeletion = g_list_append (extendeddeletion,
- track);
- hash_delete ((gpointer)sei); /* free sei */
+ {
+ hash_delete ((gpointer)sei);
}
- sei = NULL;
}
- if (strcmp (arg, "xxx") != 0)
- {
- sei = g_malloc0 (sizeof (struct track_extended_info));
- sei->ipod_id = atoi (arg);
+ else
+ { /* this is a deleted track that hasn't yet been
+ removed from the iPod's hard drive */
+ Track *track = gp_track_new ();
+ track->ipod_path = g_strdup (sei->ipod_path);
+ extendeddeletion = g_list_append (extendeddeletion,
+ track);
+ hash_delete ((gpointer)sei); /* free sei */
}
+ sei = NULL;
}
- else if (g_ascii_strcasecmp (line, "version") == 0)
- { /* found version */
- extendedinfoversion = g_ascii_strtod (arg, NULL);
- }
- else if (sei == NULL)
+ if (strcmp (arg, "xxx") != 0)
{
- gtkpod_warning (_("%s:\nFormat error: %s\n"), name, buf);
- success = FALSE;
- break;
+ sei = g_malloc0 (sizeof (struct track_extended_info));
+ sei->ipod_id = atoi (arg);
}
- else if (g_ascii_strcasecmp (line, "hostname") == 0)
- sei->hostname = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "converted_file") == 0)
- sei->converted_file = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "filename_locale") == 0)
- sei->pc_path_locale = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "filename_utf8") == 0)
- sei->pc_path_utf8 = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "thumbnail_locale") == 0)
- sei->thumb_path_locale = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "thumbnail_utf8") == 0)
- sei->thumb_path_utf8 = g_strdup (arg);
- else if ((g_ascii_strcasecmp (line, "md5_hash") == 0) ||
- (g_ascii_strcasecmp (line, "sha1_hash") == 0))
- { /* only accept hash value if version is >= 0.53 or
- PATH_MAX is 4096 -- in 0.53 I changed the MD5 hash
- routine to using blocks of 4096 Bytes in
- length. Before it was PATH_MAX, which might be
- different on different architectures. */
- if ((extendedinfoversion >= 0.53) || (PATH_MAX == 4096))
- sei->sha1_hash = g_strdup (arg);
- }
- else if (g_ascii_strcasecmp (line, "charset") == 0)
- sei->charset = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "transferred") == 0)
- sei->transferred = atoi (arg);
- else if (g_ascii_strcasecmp (line, "filename_ipod") == 0)
- sei->ipod_path = g_strdup (arg);
- else if (g_ascii_strcasecmp (line, "pc_mtime") == 0)
- sei->mtime = (time_t)g_ascii_strtoull (arg, NULL, 10);
- else if (g_ascii_strcasecmp (line, "local_itdb_id") == 0)
- sei->local_itdb_id = (guint64)g_ascii_strtoull (arg, NULL, 10);
- else if (g_ascii_strcasecmp (line, "local_track_dbid") == 0)
- sei->local_track_dbid = (guint64)g_ascii_strtoull (arg, NULL,
10);
+ }
+ else if (g_ascii_strcasecmp (line, "version") == 0)
+ { /* found version */
+ extendedinfoversion = g_ascii_strtod (arg, NULL);
+ }
+ else if (sei == NULL)
+ {
+ gtkpod_warning (_("%s:\nFormat error: %s\n"), name, buf);
+ success = FALSE;
+ g_free (line);
+ break;
+ }
+ else if (g_ascii_strcasecmp (line, "hostname") == 0)
+ sei->hostname = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "converted_file") == 0)
+ sei->converted_file = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "filename_locale") == 0)
+ sei->pc_path_locale = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "filename_utf8") == 0)
+ sei->pc_path_utf8 = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "thumbnail_locale") == 0)
+ sei->thumb_path_locale = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "thumbnail_utf8") == 0)
+ sei->thumb_path_utf8 = g_strdup (arg);
+ else if ((g_ascii_strcasecmp (line, "md5_hash") == 0) ||
+ (g_ascii_strcasecmp (line, "sha1_hash") == 0))
+ { /* only accept hash value if version is >= 0.53 or
+ PATH_MAX is 4096 -- in 0.53 I changed the MD5 hash
+ routine to using blocks of 4096 Bytes in
+ length. Before it was PATH_MAX, which might be
+ different on different architectures. */
+ if ((extendedinfoversion >= 0.53) || (PATH_MAX == 4096))
+ sei->sha1_hash = g_strdup (arg);
+ }
+ else if (g_ascii_strcasecmp (line, "charset") == 0)
+ sei->charset = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "transferred") == 0)
+ sei->transferred = atoi (arg);
+ else if (g_ascii_strcasecmp (line, "filename_ipod") == 0)
+ sei->ipod_path = g_strdup (arg);
+ else if (g_ascii_strcasecmp (line, "pc_mtime") == 0)
+ sei->mtime = (time_t)g_ascii_strtoull (arg, NULL, 10);
+ else if (g_ascii_strcasecmp (line, "local_itdb_id") == 0)
+ sei->local_itdb_id = (guint64)g_ascii_strtoull (arg, NULL, 10);
+ else if (g_ascii_strcasecmp (line, "local_track_dbid") == 0)
+ sei->local_track_dbid = (guint64)g_ascii_strtoull (arg, NULL, 10);
+ g_free (line);
}
g_free (sha1);
fclose (fp);
Modified: gtkpod/trunk/src/info.c
===================================================================
--- gtkpod/trunk/src/info.c 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/src/info.c 2007-06-17 14:14:38 UTC (rev 1550)
@@ -454,6 +454,9 @@
gtk_statusbar_pop(GTK_STATUSBAR(gtkpod_statusbar), context);
gtk_statusbar_push(GTK_STATUSBAR(gtkpod_statusbar), context, text);
+
+ g_free (text);
+
gtkpod_statusbar_reset_timeout ();
}
}
Modified: gtkpod/trunk/src/prefs.c
===================================================================
--- gtkpod/trunk/src/prefs.c 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/src/prefs.c 2007-06-17 14:14:38 UTC (rev 1550)
@@ -1156,9 +1156,11 @@
/* This string was a wrong autoconvert--just ignore it */
buf = prefs_get_string("export_template");
- if (strcmp(buf, "%a - %a/%T - %T.mp3") == 0)
+ if (buf && strcmp(buf, "%a - %a/%T - %T.mp3") == 0)
prefs_set_string("export_template", NULL);
+ g_free (buf);
+
/* We changed the meaning of the %x in export_template */
if (version < 0.72)
{
Modified: gtkpod/trunk/src/syncdir.c
===================================================================
--- gtkpod/trunk/src/syncdir.c 2007-06-17 08:44:07 UTC (rev 1549)
+++ gtkpod/trunk/src/syncdir.c 2007-06-17 14:14:38 UTC (rev 1550)
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-04-28 00:06:00 jcs>
+/* Time-stamp: <2007-06-17 23:01:18 jcs>
|
| Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
| Part of the gtkpod project.
@@ -613,6 +613,7 @@
remove = TRUE;
}
}
+ g_free (dirname_local);
}
if (remove)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2