[rhythmbox] ipod: Fix use of uninitialised memory
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] ipod: Fix use of uninitialised memory
- Date: Thu, 24 Feb 2011 17:24:45 +0000 (UTC)
commit 57b419e03285cedba66d1896e6e9be5c32098035
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 24 06:54:27 2011 +0000
ipod: Fix use of uninitialised memory
When the Play Counts file doesn't exist, we can't remove it.
plugins/ipod/rb-ipod-source.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index 5fab96a..e6f1e21 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -1008,18 +1008,22 @@ remove_playcount_file (RBiPodSource *source)
RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
char *itunesdb_dir;
char *playcounts_file;
- int result;
+ int result = -1;
const char *mountpoint;
mountpoint = rb_ipod_db_get_mount_path (priv->ipod_db);
itunesdb_dir = itdb_get_itunes_dir (mountpoint);
playcounts_file = itdb_get_path (itunesdb_dir, "Play Counts");
- result = g_unlink (playcounts_file);
+ if (playcounts_file != NULL)
+ result = g_unlink (playcounts_file);
if (result == 0) {
rb_debug ("iPod Play Counts file successfully deleted");
} else {
- rb_debug ("Failed to remove iPod Play Counts file: %s",
- strerror (errno));
+ if (playcounts_file != NULL)
+ rb_debug ("Failed to remove iPod Play Counts file: %s",
+ strerror (errno));
+ else
+ rb_debug ("Failed to remove non-existant iPod Play Counts file");
}
g_free (itunesdb_dir);
g_free (playcounts_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]