dbus/dbus dbus-errors.c,1.27,1.28

Havoc Pennington hp at freedesktop.org
Wed Aug 10 07:36:57 EST 2005


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv25614/dbus

Modified Files:
	dbus-errors.c 
Log Message:
2005-08-09  Havoc Pennington  <hp at redhat.com>

	* dbus/dbus-errors.c: apply patch from Timo Teras to make a
	malloc'd copy of the name parameter



Index: dbus-errors.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-errors.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- dbus-errors.c	10 Aug 2004 03:06:59 -0000	1.27
+++ dbus-errors.c	9 Aug 2005 21:36:55 -0000	1.28
@@ -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-commit mailing list