[PATCH] fix DBusError leaking libhal and libhal-storage
David Zeuthen
david at fubar.dk
Sun Jul 23 14:57:58 PDT 2006
On Sat, 2006-07-22 at 21:51 +0200, Danny Kukawka wrote:
> On Saturday 22 July 2006 17:08, David Zeuthen wrote:
> > So, how about making
> [...]
> > complain to stderr if this macro is used but the error isn't set? I mean
> > we only should be using the macro if we know the error is set. With that
> > it looks good to me.
>
> Only to understand correct: you want to print a message to the log if the
> macro is used but the error is not set?
>
> I don't see a problem to use the macro also if the error is not set, because
> dbus_error_is_set() check if the error is set. This is IMO better than a
> memory leak which cost much more than the check.
Yes, but want to fix up where we use it wrong - we should only be
freeing errors when we detect them.
> There are also two other possible solutions:
> 1.) return the error (via a additional pointer as parameter)
Would break API so probably not a good idea. ABI might be preserved (the
C ABI is preserved when just adding paramaters) but I don't like it.
> 2.) use NULL instead of a DBusError in function calls (currently there is no
> information returned to the caller and we also not print any debug message
> from the error)
I think the patch you wrote with a warning to stderr if the macro is
used incorrectly is the way to go.
Cheers,
David
More information about the hal
mailing list