[rhythmbox] fix a couple of leaks detected by cppcheck



commit a82365a07a44aac3e9248ea8ffbe7fef5f8cdf5b
Author: Martin Ettl <ettl martin gmx de>
Date:   Wed Mar 24 06:53:44 2010 +1000

    fix a couple of leaks detected by cppcheck

 plugins/cd-recorder/rb-recorder-gst.c |    8 ++++++--
 plugins/mtpdevice/rb-mtp-source.c     |    4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/plugins/cd-recorder/rb-recorder-gst.c b/plugins/cd-recorder/rb-recorder-gst.c
index 14ca6c1..ac96d13 100644
--- a/plugins/cd-recorder/rb-recorder-gst.c
+++ b/plugins/cd-recorder/rb-recorder-gst.c
@@ -1074,8 +1074,10 @@ acb_wave_time (const char *filename)
         if (fd < 0)
                 return ACB_ERROR_OPEN;
 
-        if (read (fd, buffer, WAV_SIGNATURE_SIZE) != WAV_SIGNATURE_SIZE)
+        if (read (fd, buffer, WAV_SIGNATURE_SIZE) != WAV_SIGNATURE_SIZE) {
+		close (fd);
                 return ACB_ERROR_NOT_WAVE_TOO_SMALL;
+	}
 
         if ((buffer [0] != 'R') ||
             (buffer [1] != 'I') ||
@@ -1088,8 +1090,10 @@ acb_wave_time (const char *filename)
             (buffer [12] != 'f') ||
             (buffer [13] != 'm') ||
             (buffer [14] != 't') ||
-            (buffer [15] != ' '))
+            (buffer [15] != ' ')) {
+		close (fd);
                 return ACB_ERROR_NOT_WAVE_FORMAT;
+	}
 
         if (read (fd, &len, sizeof(len)) != sizeof (len)) {
                 close (fd);
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index 82030a5..bff85e9 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -1158,8 +1158,10 @@ prepare_encoder_sink_cb (RBEncoderFactory *factory,
 	db = get_db_for_source (source);
 	entry = rhythmdb_entry_lookup_by_id (db, track_id);
 	g_object_unref (db);
-	if (entry == NULL)
+	if (entry == NULL) {
+		g_free (extension);
 		return;
+	}
 
 	track = LIBMTP_new_track_t ();
 	track->title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]