summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-05-18 09:54:03 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-05-18 22:24:12 +0300
commitcb4b48b5a280301c8bb521afa5550a87ccc872ec (patch)
treea2c6e686748ab3e342a8a717dced1804373b00df /client
parent5009ba332ba39f84d749b782a31455068a6a2d9c (diff)
downloadobexd-cb4b48b5a280301c8bb521afa5550a87ccc872ec.tar.gz
client: Fix NULL dereference in case of error
obc_session_queue assumes that the given transfer is not NULL, so this must be checked explicitly.
Diffstat (limited to 'client')
-rw-r--r--client/manager.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/client/manager.c b/client/manager.c
index d896ba4..15136e2 100644
--- a/client/manager.c
+++ b/client/manager.c
@@ -294,13 +294,18 @@ static void pull_obc_session_callback(struct obc_session *session,
}
pull = obc_transfer_get("text/x-vcard", NULL, data->filename, &gerr);
+ if (pull == NULL) {
+ reply = g_dbus_create_error(data->message,
+ "org.openobex.Error.Failed",
+ "%s", gerr->message);
+ goto fail;
+ }
if (!obc_session_queue(session, pull, pull_complete_callback, data,
&gerr)) {
reply = g_dbus_create_error(data->message,
"org.openobex.Error.Failed",
"%s", gerr->message);
- g_error_free(gerr);
goto fail;
}
@@ -311,6 +316,7 @@ fail:
shutdown_session(session);
dbus_message_unref(data->message);
dbus_connection_unref(data->connection);
+ g_clear_error(&gerr);
g_free(data->filename);
g_free(data->sender);
g_free(data);
@@ -516,13 +522,18 @@ static void capability_obc_session_callback(struct obc_session *session,
pull = obc_transfer_get("x-obex/capability", NULL, data->filename,
&gerr);
+ if (pull == NULL) {
+ reply = g_dbus_create_error(data->message,
+ "org.openobex.Error.Failed",
+ "%s", gerr->message);
+ goto fail;
+ }
if (!obc_session_queue(session, pull, capabilities_complete_callback,
data, &gerr)) {
reply = g_dbus_create_error(data->message,
"org.openobex.Error.Failed",
"%s", gerr->message);
- g_error_free(gerr);
goto fail;
}
@@ -533,6 +544,7 @@ fail:
shutdown_session(session);
dbus_message_unref(data->message);
dbus_connection_unref(data->connection);
+ g_clear_error(&gerr);
g_free(data->sender);
g_free(data);
}