hal: Branch 'master' - 4 commits

Danny Kukawka dkukawka at kemper.freedesktop.org
Sun Oct 30 06:16:02 PDT 2011


 hald/freebsd/probing/freebsd_dvd_rw_utils.c |   14 +++++++-------
 hald/ids.c                                  |    3 +--
 hald/linux/addons/addon-leds.c              |    5 +++--
 hald/linux/probing/probe-ieee1394-unit.c    |    2 +-
 hald/linux/probing/probe-video4linux.c      |    2 --
 libhal/libhal.c                             |    5 ++++-
 6 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit 08e7d577151227199fc7c83a4a917ea1b922b14d
Author: Thomas Jarosch <thomas.jarosch at intra2net.com>
Date:   Wed Oct 5 22:15:17 2011 +0200

    Fix mismatching allocation/deallocation
    
    Detected by "cppcheck"
    
    Please CC: comments.
    
    Signed-off-by: Thomas Jarosch <thomas.jarosch at intra2net.com>
    Signed-off-by: Danny Kukawka <danny.kukawka at web.de>

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);
 
commit 38cb713132a60758b07380c8d555c61d06eb0195
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Sun Oct 30 13:35:35 2011 +0100

    don't close file descriptor twice
    
    Don't close file descriptor twice. Adopted version of a patch from
    Thomas Jarosch <thomas.jarosch at intra2net.com>.

diff --git a/hald/linux/probing/probe-video4linux.c b/hald/linux/probing/probe-video4linux.c
index b055720..f934d53 100644
--- a/hald/linux/probing/probe-video4linux.c
+++ b/hald/linux/probing/probe-video4linux.c
@@ -146,8 +146,6 @@ main (int argc, char *argv[])
 	libhal_device_commit_changeset (ctx, cset, &error);
 	libhal_device_free_changeset (cset);
 
-	close (fd);
-
 	ret = 0;
 
 out:
commit 4f08be0f701da3b941ab9ecf04628317d36b7e8c
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Aug 23 16:42:00 2011 +0200

    fixed typo from commit c648362a711
    
    Fixed typo from commit c648362a711.

diff --git a/hald/ids.c b/hald/ids.c
index e7e32d6..98e4f9f 100644
--- a/hald/ids.c
+++ b/hald/ids.c
@@ -184,7 +184,7 @@ ids_find_pci (int vendor_id, int product_id,
 			 * already */
 			if (*subsys_vendor_name == NULL
 			    && subsys_vendor_id != 0) {
-				if (memcmp (line, rep_vi, 4) == 0) {
+				if (memcmp (line, rep_svi, 4) == 0) {
 					/* found it */
 					for (i = 4; i < line_len; i++) {
 						if (!isspace (line[i]))
commit c648362a711b029847215ca228454b36a6572783
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Aug 23 16:37:20 2011 +0200

    fix some compiler warnings
    
    Fixed some compiler warnings (strict-aliasing etc.).

diff --git a/hald/ids.c b/hald/ids.c
index b29df3b..e7e32d6 100644
--- a/hald/ids.c
+++ b/hald/ids.c
@@ -184,8 +184,7 @@ ids_find_pci (int vendor_id, int product_id,
 			 * already */
 			if (*subsys_vendor_name == NULL
 			    && subsys_vendor_id != 0) {
-				if ((*((dbus_uint32_t *) line)) ==
-				    (*((dbus_uint32_t *) rep_svi))) {
+				if (memcmp (line, rep_vi, 4) == 0) {
 					/* found it */
 					for (i = 4; i < line_len; i++) {
 						if (!isspace (line[i]))
diff --git a/hald/linux/addons/addon-leds.c b/hald/linux/addons/addon-leds.c
index e3ab34f..e999488 100644
--- a/hald/linux/addons/addon-leds.c
+++ b/hald/linux/addons/addon-leds.c
@@ -61,16 +61,17 @@ get_leds_brightness (const char *udi)
 	int brightness;
 	
 	f = NULL;
+	brightness = -1;
 
 	if (!g_hash_table_lookup_extended (leds, udi, NULL, (gpointer) &sysfs_path)) {
-		return -1;
+		return brightness;
 	}
 
 	snprintf (path, sizeof (path), "%s/brightness", sysfs_path);
 
         if ((f = fopen (path, "rb")) == NULL) {
 		HAL_WARNING(("Could not read brightness from '%s' for device '%s'", path, udi));
-		return -1;
+		return brightness;
 	}
 
 	if (fgets (buf, sizeof (buf), f) == NULL) {
diff --git a/hald/linux/probing/probe-ieee1394-unit.c b/hald/linux/probing/probe-ieee1394-unit.c
index aaa92e2..2b53c30 100644
--- a/hald/linux/probing/probe-ieee1394-unit.c
+++ b/hald/linux/probing/probe-ieee1394-unit.c
@@ -253,7 +253,7 @@ handle_request (int fd, struct fw_cdev_event_request *request)
 	
 	send_response (fd, request->handle, RCODE_COMPLETE, NULL, 0);
 	
-	response = (void *) request->data;
+	response = u64_to_ptr(request->data);
 	if (response->frame.cts != CTS_AVC) {
 		HAL_ERROR (("not an fcp response"));
 		return -1;
diff --git a/libhal/libhal.c b/libhal/libhal.c
index c9d9f74..d6ff01c 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -339,11 +339,14 @@ static dbus_bool_t
 libhal_property_fill_value_from_variant (LibHalProperty *p, DBusMessageIter *var_iter)
 {
 	DBusMessageIter iter_array;
+	int type;
+
+	type = p->type;
 
 	LIBHAL_CHECK_PARAM_VALID(p, "LibHalProperty *p", FALSE);
 	LIBHAL_CHECK_PARAM_VALID(var_iter, "DBusMessageIter *var_iter", FALSE);
 
-	switch (p->type) {
+	switch (type) {
 	case DBUS_TYPE_ARRAY:
 		if (dbus_message_iter_get_element_type (var_iter) != DBUS_TYPE_STRING)
 			return FALSE;


More information about the hal-commit mailing list