dbus_connection_send_with_reply_and_block and errors
Timo Teräs
timo.teras at nokia.com
Wed Aug 10 04:58:57 EST 2005
ext Colin Walters wrote:
> On Tue, 2005-08-09 at 21:02 +0300, Timo Teräs wrote:
>>Yes. Now that I thinked more about this, it might be good to do the
>>change in dbus_set_error() since most people will propably assume that
>>it dups both fields. Atleast I thought so until I read the docs in more
>>detail. So I agree with Havoc that doing assignment of .name in
>>dbus_set_error() is a bad idea.
>>
>>I'll do a patch for this and post it asap for review.
>
> Ok.
Here you go. Passes 'make check'.
Cheers,
Timo
-------------- next part --------------
Index: dbus/dbus-errors.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-errors.c,v
retrieving revision 1.27
diff -u -r1.27 dbus-errors.c
--- dbus/dbus-errors.c 10 Aug 2004 03:06:59 -0000 1.27
+++ dbus/dbus-errors.c 9 Aug 2005 18:56:18 -0000
@@ -180,7 +180,10 @@
real = (DBusRealError *)error;
if (!real->const_message)
- dbus_free (real->message);
+ {
+ dbus_free (real->name);
+ dbus_free (real->message);
+ }
dbus_error_init (error);
}
@@ -306,7 +309,7 @@
* @todo should be called dbus_error_set()
*
* @param error the error.
- * @param name the error name (not copied!!!)
+ * @param name the error name
* @param format printf-style format string.
*/
void
@@ -359,12 +362,17 @@
_dbus_string_free (&str);
goto nomem;
}
+ _dbus_string_free (&str);
- real->name = name;
+ real->name = _dbus_strdup(name);
+ if (real->name == NULL)
+ {
+ dbus_free(real->message);
+ real->message = NULL;
+ goto nomem;
+ }
real->const_message = FALSE;
- _dbus_string_free (&str);
-
return;
nomem:
More information about the dbus
mailing list