[PATCH 2/2] Fix mismatching allocation/deallocation

Thomas Jarosch thomas.jarosch at intra2net.com
Wed Oct 5 13:15:17 PDT 2011


Detected by "cppcheck"

Please CC: comments.

Signed-off-by: Thomas Jarosch <thomas.jarosch at intra2net.com>
---
 hald/freebsd/probing/freebsd_dvd_rw_utils.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hald/freebsd/probing/freebsd_dvd_rw_utils.c b/hald/freebsd/probing/freebsd_dvd_rw_utils.c
index c004916..130d8a3 100644
--- a/hald/freebsd/probing/freebsd_dvd_rw_utils.c
+++ b/hald/freebsd/probing/freebsd_dvd_rw_utils.c
@@ -45,7 +45,7 @@ scsi_command_new_from_cdrom (HFPCDROM *cdrom)
 static void
 scsi_command_free (ScsiCommand * cmd)
 {
-	free (cmd);
+	g_free (cmd);
 }
 
 static void
@@ -107,7 +107,7 @@ get_dvd_r_rw_profile (HFPCDROM *cdrom)
 	if (scsi_command_transport (cmd, READ, list, len)) {
 		/* GET CONFIGURATION failed */
 		scsi_command_free (cmd);
-		free (list);
+		g_free (list);
 		return -1;
 	}
 
@@ -170,7 +170,7 @@ get_dvd_r_rw_profile (HFPCDROM *cdrom)
 	}
 
 	scsi_command_free (cmd);
-	free (list);
+	g_free (list);
 
 	return retval;
 
@@ -230,7 +230,7 @@ pull_page2a_from_cdrom (HFPCDROM *cdrom)
 	if (scsi_command_transport (cmd, READ, page2A, len)) {
 		/* MODE SENSE failed */
 		scsi_command_free (cmd);
-		free (page2A);
+		g_free (page2A);
 		return NULL;
 	}
 
@@ -330,7 +330,7 @@ get_write_speeds (const unsigned char *p, int length, int max_speed)
 	}
 
 free_tmpspeeds:
-	free (tmpspeeds);
+	g_free (tmpspeeds);
 
 	return result;
 }
@@ -462,7 +462,7 @@ get_disc_capacity_cdr (HFPCDROM *cdrom, guint64 *size)
 
 	if (scsi_command_transport (cmd, READ, atip, len)) {
 		/* READ TOC failed */
-		free (atip);
+		g_free (atip);
 		goto done;
 	}
 
@@ -473,7 +473,7 @@ get_disc_capacity_cdr (HFPCDROM *cdrom, guint64 *size)
 	}
 	retval = 0;
 
-	free (atip);
+	g_free (atip);
  done:
 	scsi_command_free (cmd);
 
-- 
1.7.4.4



More information about the hal mailing list