@@ -177,7 +177,7 @@ struct HCIInfo *bt_host_hci(const char *id)
}
# endif
- s = g_malloc0(sizeof(struct bt_host_hci_s));
+ s = g_new0(struct bt_host_hci_s, 1);
s->fd = fd;
s->hci.cmd_send = bt_host_cmd;
s->hci.sco_send = bt_host_sco;
@@ -157,7 +157,7 @@ void bt_vhci_init(struct HCIInfo *info)
exit(-1);
}
- s = g_malloc0(sizeof(struct bt_vhci_s));
+ s = g_new0(struct bt_vhci_s, 1);
s->fd = fd;
s->info = info ?: qemu_next_hci();
s->info->opaque = s;
@@ -55,7 +55,7 @@ static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
/* Slaves that don't hold any additional per link state can use these */
static void bt_dummy_lmp_connection_request(struct bt_link_s *req)
{
- struct bt_link_s *link = g_malloc0(sizeof(struct bt_link_s));
+ struct bt_link_s *link = g_new0(struct bt_link_s, 1);
link->slave = req->slave;
link->host = req->host;
@@ -135,7 +135,7 @@ struct bt_scatternet_s *qemu_find_bt_vlan(int id)
if (vlan->id == id)
return &vlan->net;
}
- vlan = g_malloc0(sizeof(struct bt_vlan_s));
+ vlan = g_new0(struct bt_vlan_s, 1);
vlan->id = id;
pvlan = &first_bt_vlan;
while (*pvlan != NULL)
@@ -742,7 +742,7 @@ static void bt_hci_connection_reject_event(struct bt_hci_s *hci,
static void bt_hci_connection_accept(struct bt_hci_s *hci,
struct bt_device_s *host)
{
- struct bt_hci_link_s *link = g_malloc0(sizeof(struct bt_hci_link_s));
+ struct bt_hci_link_s *link = g_new0(struct bt_hci_link_s, 1);
evt_conn_complete params;
uint16_t handle;
uint8_t status = HCI_SUCCESS;
@@ -2158,7 +2158,7 @@ static void bt_hci_destroy(struct bt_device_s *dev)
struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net)
{
- struct bt_hci_s *s = g_malloc0(sizeof(struct bt_hci_s));
+ struct bt_hci_s *s = g_new0(struct bt_hci_s, 1);
s->lm.inquiry_done = timer_new_ns(QEMU_CLOCK_VIRTUAL, bt_hci_inquiry_done, s);
s->lm.inquiry_next = timer_new_ns(QEMU_CLOCK_VIRTUAL, bt_hci_inquiry_next, s);
@@ -1241,7 +1241,7 @@ static void l2cap_lmp_connection_request(struct bt_link_s *link)
/* Always accept - we only get called if (dev->device->page_scan). */
- l2cap = g_malloc0(sizeof(struct slave_l2cap_instance_s));
+ l2cap = g_new0(struct slave_l2cap_instance_s, 1);
l2cap->link.slave = &dev->device;
l2cap->link.host = link->host;
l2cap_init(&l2cap->l2cap, &l2cap->link, 0);
@@ -1262,7 +1262,7 @@ static void l2cap_lmp_connection_complete(struct bt_link_s *link)
return;
}
- l2cap = g_malloc0(sizeof(struct l2cap_instance_s));
+ l2cap = g_new0(struct l2cap_instance_s, 1);
l2cap_init(l2cap, link, 1);
link->acl_mode = acl_active;
@@ -1358,7 +1358,7 @@ void bt_l2cap_psm_register(struct bt_l2cap_device_s *dev, int psm, int min_mtu,
exit(-1);
}
- new_psm = g_malloc0(sizeof(*new_psm));
+ new_psm = g_new0(struct bt_l2cap_psm_s, 1);
new_psm->psm = psm;
new_psm->min_mtu = min_mtu;
new_psm->new_channel = new_channel;