summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2009-12-14 12:58:31 +0000
committerBastien Nocera <hadess@hadess.net>2009-12-14 12:58:31 +0000
commitad449a48b80cee46d2f946a27fb814d1b8abbba1 (patch)
tree198949c84f3a09ac0df7e40e549159111fb450ff /lib
parent13f92d32f2f17d32de86d4b04184fe945ea35f8c (diff)
downloadgnome-bluetooth-ad449a48b80cee46d2f946a27fb814d1b8abbba1.tar.gz
Fix crash when obex-client isn't running already
When obex-client isn't running yet, we can't get a name owner for the service. But we'd still get a callback from the service when trying to use it, and crash trying to compare the sender with a NULL string. Instead, set the owner's dbus name if we don't already have one in obex_agent_request(). See: https://bugzilla.redhat.com/show_bug.cgi?id=544881
Diffstat (limited to 'lib')
-rw-r--r--lib/obex-agent.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/obex-agent.c b/lib/obex-agent.c
index 38b2fde5..276fcb34 100644
--- a/lib/obex-agent.c
+++ b/lib/obex-agent.c
@@ -78,13 +78,19 @@ static gboolean obex_agent_request(ObexAgent *agent, const char *path,
DBG("agent %p sender %s", agent, sender);
- if (g_str_equal(sender, priv->busname) == FALSE) {
+ if (priv->busname == NULL) {
+ /* When we get called the first time, if OBEX_SERVICE
+ * was not available, we get its name here */
+ priv->busname = sender;
+ } else {
+ if (g_str_equal(sender, priv->busname) == FALSE) {
+ g_free (sender);
+ return FALSE;
+ }
+
g_free (sender);
- return FALSE;
}
- g_free (sender);
-
if (priv->request_func) {
DBusGProxy *proxy;