Hi, On Tue, Apr 29, 2014, Lukasz Rymanowski wrote: > +static uint8_t write_request(const uint8_t *cmd, uint16_t cmd_len, > + struct gatt_device *dev) > +{ > + uint16_t handle; > + uint16_t offset = 0; > + uint16_t len; > + uint8_t value[ATT_DEFAULT_LE_MTU]; > + size_t vlen; > + struct req_data *req_data; > + > + req_data = new0(struct req_data, 1); > + if (!req_data) > + return ATT_ECODE_UNLIKELY; > + > + switch (cmd[0]) { > + case ATT_OP_WRITE_CMD: > + len = dec_write_cmd(cmd, cmd_len, &handle, value, &vlen); > + if (!len) { > + free(req_data); > + return ATT_ECODE_INVALID_PDU; > + } > + break; > + case ATT_OP_WRITE_REQ: > + len = dec_write_req(cmd, cmd_len, &handle, value, &vlen); > + if (!len) { > + free(req_data); > + return ATT_ECODE_INVALID_PDU; > + } > + break; > + case ATT_OP_PREP_WRITE_REQ: > + len = dec_prep_write_req(cmd, cmd_len, &handle, &offset, > + value, &vlen); > + if (!len) { > + free(req_data); > + return ATT_ECODE_INVALID_PDU; > + } > + break; > + default: > + error("gatt: Unexpected write type 0x02%x", cmd[0]); > + free(req_data); > + return ATT_ECODE_REQ_NOT_SUPP; > + } > + > + req_data->dev = dev; > + req_data->opcode = cmd[0]; > + > + if (!gatt_db_write(gatt_db, handle, offset, value, vlen, &req_data)) { > + free(req_data); > + return ATT_ECODE_UNLIKELY; > + } > + > + return 0; > +} Same question here: where is req_data freed if gatt_db_read succeeds? Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html