diff --git a/obexd/client/bluetooth.c b/obexd/client/bluetooth.c
index a832a3f..a14b75b 100644
--- a/obexd/client/bluetooth.c
+++ b/obexd/client/bluetooth.c
bdaddr_t dst;
uint16_t port;
sdp_session_t *sdp;
+ sdp_record_t *sdp_record;
GIOChannel *io;
char *service;
obc_transport_func func;
if (session->sdp)
sdp_close(session->sdp);
+ if (session->sdp_record)
+ sdp_record_free(session->sdp_record);
+
g_free(session->service);
g_free(session);
}
if (data != NULL && (data->val.uint16 & 0x0101) == 0x0001)
ch = data->val.uint16;
- sdp_record_free(rec);
-
+ /* Cache the sdp record associated with the service that we
+ * attempt to connect. This allows reading its application
+ * specific service attributes. */
if (ch > 0) {
port = ch;
+ session->sdp_record = rec;
break;
}
+ sdp_record_free(rec);
+
scanned += recsize;
rsp += recsize;
bytesleft -= recsize;