memory freeing necessary?

Andre Puschmann andre.puschmann at stud.tu-ilmenau.de
Thu Jul 27 09:36:35 PDT 2006


David Zeuthen wrote:
> Indeed it is. The pattern we're trying to use is that the caller frees
> anything it callee returns unless it's explicitly marked as const. We
> also try to document this in libhal and libhal-storage, patches welcome
> to improve the documentation.

hi guys,
i did a lot of testing and debugging last time and somehow i am a bit
confused about how it worked.
if i try to handle every error that for instance libhal_ctx_init() can
produce (if hald is not running) and free all memory that was allocated
until this point my app crashes all time with a segfault in
dbus_connection_remove_filter() in libdbus.
if dbus is not running than it looks like described here
https://bugzilla.ubuntu.com/show_bug.cgi?id=12250.
on the other hand if i don't free anything (just in case everything is
ok, like lshal) my app does not crash. but if i restart hald while my
app is running i get an dbus error "org.freedesktop.DBus.Error.NoReply:
No reply within specified time". after a further restart of my app
everything works fine.
i don't know which method to use in order to handle errors correctly and
to provide availability of the functions that use libhal.

any hints?

regard
andre



More information about the hal mailing list