how to free the memory got from dbus_message_get_args() ?
falls huang
falls.huang at gmail.com
Fri Aug 11 04:34:44 PDT 2006
Hello!
I'm new to dbus, and I have searched the mailing list but couldn't
find any similar problem . My linux box version : ubuntu(dapper) ,
dbus(0.60)
If I uncomment either of "free(s)" or "dbus_free(s)" , the
program will crash .
But if I don't free , there'll be a memory leal.
How can I fix this problem ?
The code is below :
char *s;
dbus_error_init (&error);
if (dbus_message_get_args
(message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
g_print("Ping received: %s %x\n", s, s );
//free(s);
//dbus_free (s);
} else {
g_print("Ping received, but error getting message: %s\n",
error.message);
dbus_error_free (&error);
}
--
Regards
Falls Huang
More information about the dbus
mailing list