tags 539624 +patch

On Aug 09 2009, Rogério Brito wrote:
> Of course, there was a NULL pointer dereference: the "devices" pointer
> is initialized to NULL at the top of the function and can never get
> assigned any value (well, this is the case here):
> 
> ,----
> | (...)
> | libhal.c 3126 : LibHalContext *ctx is NULL
> | rhythmbox: brasero-medium-monitor.c:451: brasero_medium_monitor_init: 
> Assertion `devices != ((void *)0)' failed.
> | Aborted
> `----

OK. I just fixed this with the attached patch.

Applied, compiled, tested, working.  Please, apply.


Regards, Rogério Brito.

-- 
Rogério Brito : rbr...@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org
#
# Author:
# Rogério Brito <[email protected]>
# 
# Date: Sun, 09 Aug 2009 08:31:41 -0300
#
# Description:
# libbrasero-media does not check properly if a null-pointer is returned
# when checking for devices found by libhal. This makes the check stricter.
#
--- a/libbrasero-media/brasero-medium-monitor.c
+++ b/libbrasero-media/brasero-medium-monitor.c
@@ -437,7 +437,10 @@ brasero_medium_monitor_init (BraseroMedi
 	devices = libhal_find_device_by_capability (ctx,
 						    "storage.cdrom", &nb_devices,
 						    &error);
-	if (dbus_error_is_set (&error)) {
+
+	/* if hal is not present, devices *CAN* be NULL (and *does*, sometimes).
+	 *    -- Rogerio Brito <[email protected]> */
+	if (devices == NULL || dbus_error_is_set (&error)) {
 		BRASERO_MEDIA_LOG ("Hal is not running : %s\n", error.message);
 		dbus_error_free (&error);
 		return;

Reply via email to