summaryrefslogtreecommitdiff
path: root/tools/rctest.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-08-12 16:43:08 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-08-13 14:05:27 +0300
commit30dfb626abf35d6c1d0a6016655f99fad9e9b924 (patch)
tree8d42f28fa33f285285b432c81cc443ad7d7c48b2 /tools/rctest.c
parentd72f1713ae2edef21d7a9c3d74bb87d26e25cb95 (diff)
downloadbluez-30dfb626abf35d6c1d0a6016655f99fad9e9b924.tar.gz
tools/rctest: Fix resource leaks
Diffstat (limited to 'tools/rctest.c')
-rw-r--r--tools/rctest.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/rctest.c b/tools/rctest.c
index 9169e3c2c..6d84e075b 100644
--- a/tools/rctest.c
+++ b/tools/rctest.c
@@ -102,7 +102,7 @@ static float tv2fl(struct timeval tv)
static uint8_t get_channel(const char *svr, uint16_t uuid)
{
sdp_session_t *sdp;
- sdp_list_t *srch, *attrs, *rsp;
+ sdp_list_t *srch, *attrs, *rsp, *protos;
uuid_t svclass;
uint16_t attr;
bdaddr_t dst;
@@ -128,7 +128,6 @@ static uint8_t get_channel(const char *svr, uint16_t uuid)
for (; rsp; rsp = rsp->next) {
sdp_record_t *rec = (sdp_record_t *) rsp->data;
- sdp_list_t *protos;
if (!sdp_get_access_protos(rec, &protos)) {
channel = sdp_get_proto_port(protos, RFCOMM_UUID);
@@ -137,7 +136,11 @@ static uint8_t get_channel(const char *svr, uint16_t uuid)
}
}
+ sdp_list_free(protos, NULL);
+
done:
+ sdp_list_free(srch, NULL);
+ sdp_list_free(attrs, NULL);
sdp_close(sdp);
return channel;
@@ -593,6 +596,7 @@ static void send_mode(int sk)
syslog(LOG_INFO, "Close failed: %m");
else
syslog(LOG_INFO, "Done");
+ close(sk);
}
static void reconnect_mode(char *svr)