[Pkg-utopia-maintainers] Bug#562068: hald-probe-input segfaults on hal restart

Willi Mann willi at wm1.at
Tue Dec 22 16:51:34 UTC 2009


> Even more helpful would be, if you could run git bisect to find out the
> offending commit which introduced the regresseion between 0.5.13 and 0.5.14.
> The hal Git repository is available from [2].
> Unfortunately I cannot reproduce the bug here, so your assisstance would be
> really appreciated.

Unfortunately, I can't reproduce this bug after I restarted my system.
However, I have an idea about the reason the crash occured.


File probe-input.c:

int
main (int argc, char *argv[])
{
...

	DBusError error;
...
	button_type = getenv ("HAL_PROP_BUTTON_TYPE");
	if (button_type == NULL)
		goto out;


---
The core dump says that the env variable HAL_PROP_BUTTON_TYPE is not set
(I grepped for it on the strings output, and the only occurence is the
name without =..)

So if HAL_PROP_BUTTON_TYPE does not exist, the code continues at out:.
---


	if (strcmp (button_type, "lid") == 0)
...
	dbus_error_init (&error);
	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
		goto out;

---
However, the error struct is initialized after the goto out, so when

	LIBHAL_FREE_DBUS_ERROR (&error);

is called, error is not initialized.
---

out:
	if (fd >= 0)
		close (fd);

	LIBHAL_FREE_DBUS_ERROR (&error);

	if (ctx != NULL) {
		libhal_ctx_shutdown (ctx, &error);
		LIBHAL_FREE_DBUS_ERROR (&error);
		libhal_ctx_free (ctx);
	}

	return ret;
}


So maybe the error struct needs to be initialized before the first goto
out:.

WM





More information about the Pkg-utopia-maintainers mailing list