diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-09-21 21:22:41 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-09-21 21:22:41 +0000 |
commit | d0ad1ca444111052434130ea7fb810319bff8f63 (patch) | |
tree | 61cc2ec22d0d50e9d73f067430a47838ea3e7f63 | |
parent | d97e5a6a819ea0f191c5d660215b6791a5efa4e8 (diff) |
removed memory leak
-rw-r--r-- | hcid/dbus-rfcomm.c | 10 | ||||
-rw-r--r-- | hcid/dbus-sdp.c | 7 |
2 files changed, 13 insertions, 4 deletions
diff --git a/hcid/dbus-rfcomm.c b/hcid/dbus-rfcomm.c index 2aa93be8..d0c28cdb 100644 --- a/hcid/dbus-rfcomm.c +++ b/hcid/dbus-rfcomm.c @@ -613,8 +613,11 @@ static void rfcomm_conn_req_continue(sdp_record_t *rec, void *data, int err) goto failed; } - if (!sdp_get_access_protos(rec, &protos)) + if (!sdp_get_access_protos(rec, &protos)) { ch = sdp_get_proto_port(protos, RFCOMM_UUID); + sdp_list_foreach(protos, (sdp_list_func_t)sdp_list_free, NULL); + sdp_list_free(protos, NULL); + } if (ch == -1) { error_record_does_not_exist(cdata->conn, cdata->msg); goto failed; @@ -851,8 +854,11 @@ static void rfcomm_bind_req_continue(sdp_record_t *rec, void *data, int err) goto failed; } - if (!sdp_get_access_protos(rec, &protos)) + if (!sdp_get_access_protos(rec, &protos)) { ch = sdp_get_proto_port(protos, RFCOMM_UUID); + sdp_list_foreach(protos, (sdp_list_func_t)sdp_list_free, NULL); + sdp_list_free(protos, NULL); + } if (ch == -1) { error_record_does_not_exist(cdata->conn, cdata->msg); goto failed; diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index a3a9bc27..6a919144 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -1516,6 +1516,10 @@ static void get_rec_with_handle_comp_cb(uint8_t type, uint16_t err, failed: get_record_data_call_cb(ctxt->priv, rec, cb_err); + + /* FIXME: when start using cache don't free the service record */ + if (rec) + sdp_record_free(rec); get_record_data_free(ctxt->priv); transaction_context_free(ctxt); } @@ -1598,7 +1602,6 @@ static void get_rec_with_uuid_comp_cb(uint8_t type, uint16_t err, struct transaction_context *ctxt = udata; get_record_data_t *d = ctxt->priv; int csrc, tsrc, cb_err = 0; - sdp_record_t *rec = NULL; uint32_t *handle; uint8_t *pdata; @@ -1648,7 +1651,7 @@ static void get_rec_with_uuid_comp_cb(uint8_t type, uint16_t err, return; failed: - get_record_data_call_cb(d, rec, cb_err); + get_record_data_call_cb(d, NULL, cb_err); get_record_data_free(d); transaction_context_free(ctxt); } |