diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-09 00:28:40 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-09 00:28:40 +0000 |
commit | ac4b0d0c4feb291643c0e8a07a92e449e13881b5 (patch) | |
tree | eaa7265c8e10149b0fe4a7a3a8c995b1026cd1ae /hw | |
parent | dc72ac14d8ceeaac0ca63f385ba3f44fd580b963 (diff) |
Add qemu_strndup: qemu_strdup with length limit.
Also optimise qemu_strdup by using memcpy - using pstrcpy is usually
suboptimal.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5653 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/bt-hci.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/bt-hci.c b/hw/bt-hci.c index 71c12b85f6..96a5b115a0 100644 --- a/hw/bt-hci.c +++ b/hw/bt-hci.c @@ -1137,7 +1137,7 @@ static void bt_hci_reset(struct bt_hci_s *hci) hci->device.inquiry_scan = 0; hci->device.page_scan = 0; if (hci->device.lmp_name) - free((void *) hci->device.lmp_name); + qemu_free((void *) hci->device.lmp_name); hci->device.lmp_name = 0; hci->device.class[0] = 0x00; hci->device.class[1] = 0x00; @@ -1815,8 +1815,8 @@ static void bt_submit_hci(struct HCIInfo *info, LENGTH_CHECK(change_local_name); if (hci->device.lmp_name) - free((void *) hci->device.lmp_name); - hci->device.lmp_name = strndup(PARAM(change_local_name, name), + qemu_free((void *) hci->device.lmp_name); + hci->device.lmp_name = qemu_strndup(PARAM(change_local_name, name), sizeof(PARAM(change_local_name, name))); bt_hci_event_complete_status(hci, HCI_SUCCESS); break; @@ -2191,7 +2191,7 @@ static void bt_hci_done(struct HCIInfo *info) bt_device_done(&hci->device); if (hci->device.lmp_name) - free((void *) hci->device.lmp_name); + qemu_free((void *) hci->device.lmp_name); /* Be gentle and send DISCONNECT to all connected peers and those * currently waiting for us to accept or reject a connection request. |