Revision 7267c094 hw/bt-hci.c

b/hw/bt-hci.c
721 721
static void bt_hci_connection_accept(struct bt_hci_s *hci,
722 722
                struct bt_device_s *host)
723 723
{
724
    struct bt_hci_link_s *link = qemu_mallocz(sizeof(struct bt_hci_link_s));
724
    struct bt_hci_link_s *link = g_malloc0(sizeof(struct bt_hci_link_s));
725 725
    evt_conn_complete params;
726 726
    uint16_t handle;
727 727
    uint8_t status = HCI_SUCCESS;
......
736 736
            tries);
737 737

  
738 738
    if (!tries) {
739
        qemu_free(link);
739
        g_free(link);
740 740
        bt_hci_connection_reject(hci, host, HCI_REJECTED_LIMITED_RESOURCES);
741 741
        status = HCI_NO_CONNECTION;
742 742
        goto complete;
......
893 893

  
894 894
    /* We are the slave, we get to clean this burden */
895 895
    link = (struct bt_hci_link_s *) btlink;
896
    qemu_free(link);
896
    g_free(link);
897 897

  
898 898
complete:
899 899
    bt_hci_lmp_link_teardown(hci, handle);
......
928 928
    uint16_t handle = link->handle;
929 929
    evt_disconn_complete params;
930 930

  
931
    qemu_free(link);
931
    g_free(link);
932 932

  
933 933
    bt_hci_lmp_link_teardown(hci, handle);
934 934

  
......
1138 1138
    hci->device.inquiry_scan = 0;
1139 1139
    hci->device.page_scan = 0;
1140 1140
    if (hci->device.lmp_name)
1141
        qemu_free((void *) hci->device.lmp_name);
1141
        g_free((void *) hci->device.lmp_name);
1142 1142
    hci->device.lmp_name = NULL;
1143 1143
    hci->device.class[0] = 0x00;
1144 1144
    hci->device.class[1] = 0x00;
......
1816 1816
        LENGTH_CHECK(change_local_name);
1817 1817

  
1818 1818
        if (hci->device.lmp_name)
1819
            qemu_free((void *) hci->device.lmp_name);
1820
        hci->device.lmp_name = qemu_strndup(PARAM(change_local_name, name),
1819
            g_free((void *) hci->device.lmp_name);
1820
        hci->device.lmp_name = g_strndup(PARAM(change_local_name, name),
1821 1821
                        sizeof(PARAM(change_local_name, name)));
1822 1822
        bt_hci_event_complete_status(hci, HCI_SUCCESS);
1823 1823
        break;
......
2143 2143

  
2144 2144
struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net)
2145 2145
{
2146
    struct bt_hci_s *s = qemu_mallocz(sizeof(struct bt_hci_s));
2146
    struct bt_hci_s *s = g_malloc0(sizeof(struct bt_hci_s));
2147 2147

  
2148 2148
    s->lm.inquiry_done = qemu_new_timer_ns(vm_clock, bt_hci_inquiry_done, s);
2149 2149
    s->lm.inquiry_next = qemu_new_timer_ns(vm_clock, bt_hci_inquiry_next, s);
......
2188 2188
    bt_device_done(&hci->device);
2189 2189

  
2190 2190
    if (hci->device.lmp_name)
2191
        qemu_free((void *) hci->device.lmp_name);
2191
        g_free((void *) hci->device.lmp_name);
2192 2192

  
2193 2193
    /* Be gentle and send DISCONNECT to all connected peers and those
2194 2194
     * currently waiting for us to accept or reject a connection request.
......
2217 2217
    qemu_free_timer(hci->lm.inquiry_next);
2218 2218
    qemu_free_timer(hci->conn_accept_timer);
2219 2219

  
2220
    qemu_free(hci);
2220
    g_free(hci);
2221 2221
}

Also available in: Unified diff