return 0;
session_id = htab_hash(sanitized_path);
- safe_free(sanitized_path);
+ free(sanitized_path);
return session_id;
}
int i;
const char sep_str[2] = {LIST_SEPARATOR, 0};
char *tok, *tmp_str;
- size_t len = safe_strlen(driver);
+ size_t len = strlen(driver);
if (len == 0)
return SUB_API_NOTSET;
tok = strtok(tmp_str, sep_str);
while (tok != NULL) {
for (i = 0; i < usb_api_backend[api].nb_driver_names; i++) {
- if (safe_stricmp(tok, usb_api_backend[api].driver_name_list[i]) == 0) {
+ if (_stricmp(tok, usb_api_backend[api].driver_name_list[i]) == 0) {
free(tmp_str);
return i;
}
&conn_info, size, &size, NULL)) {
usbi_warn(ctx, "could not get node connection information for device '%s': %s",
device_id, windows_error_str(0));
- safe_closehandle(handle);
+ CloseHandle(handle);
return LIBUSB_ERROR_NO_DEVICE;
}
if (conn_info.ConnectionStatus == NoDeviceConnected) {
usbi_err(ctx, "device '%s' is no longer connected!", device_id);
- safe_closehandle(handle);
+ CloseHandle(handle);
return LIBUSB_ERROR_NO_DEVICE;
}
}
}
- safe_closehandle(handle);
+ CloseHandle(handle);
if (conn_info.DeviceAddress > UINT8_MAX)
usbi_err(ctx, "program assertion failed: device address overflow");
// Turn the REG_SZ SPDRP_SERVICE into REG_MULTI_SZ
if (lookup[k].reg_prop == SPDRP_SERVICE)
// our buffers are MAX_KEY_LENGTH + 1 so we can overflow if needed
- lookup[k].list[safe_strlen(lookup[k].list) + 1] = 0;
+ lookup[k].list[strlen(lookup[k].list) + 1] = 0;
// MULTI_SZ is a pain to work with. Turn it into something much more manageable
// NB: none of the driver names we check against contain LIST_SEPARATOR,
}
for (i = 0; i < priv->hid->nb_interfaces; i++) {
- if (safe_strcmp(priv->usb_interface[i].path, dev_interface_path) == 0) {
+ if ((priv->usb_interface[i].path != NULL) && strcmp(priv->usb_interface[i].path, dev_interface_path) == 0) {
usbi_dbg("interface[%d] already set to %s", i, dev_interface_path);
return LIBUSB_ERROR_ACCESS;
}
// Free any additional GUIDs
for (pass = HID_PASS + 1; pass < nb_guids; pass++)
- safe_free(guid[pass]);
+ free((void *)guid[pass]);
// Unref newly allocated devs
for (i = 0; i < unref_cur; i++)
- safe_unref_device(unref_list[i]);
+ libusb_unref_device(unref_list[i]);
free(unref_list);
return r;
buf, expected_size + 1, &read_size, overlapped)) {
if (GetLastError() != ERROR_IO_PENDING) {
usbi_dbg("Failed to Read HID Report: %s", windows_error_str(0));
- safe_free(buf);
+ free(buf);
return LIBUSB_ERROR_IO;
}
// Asynchronous wait
memcpy(data, buf, *size);
}
- safe_free(buf);
+ free(buf);
return r;
}
buf, write_size, &write_size, overlapped)) {
if (GetLastError() != ERROR_IO_PENDING) {
usbi_dbg("Failed to Write HID Output Report: %s", windows_error_str(0));
- safe_free(buf);
+ free(buf);
return LIBUSB_ERROR_IO;
}
tp->hid_buffer = buf;
if (write_size == 0)
usbi_dbg("program assertion failed - write completed synchronously, but no data was written");
- safe_free(buf);
+ free(buf);
return LIBUSB_COMPLETED;
}
} else {
usbi_warn(ctx, " could not process %s report IDs", type[j]);
}
- safe_free(value_caps);
+ free(value_caps);
}
}
struct windows_device_priv *p = _device_priv(dev);
int i;
- safe_free(p->path);
+ free(p->path);
if ((dev->num_configurations > 0) && (p->config_descriptor != NULL)) {
for (i = 0; i < dev->num_configurations; i++)
- safe_free(p->config_descriptor[i]);
+ free(p->config_descriptor[i]);
}
- safe_free(p->config_descriptor);
- safe_free(p->hid);
+ free(p->config_descriptor);
+ free(p->hid);
for (i = 0; i < USB_MAXINTERFACES; i++) {
- safe_free(p->usb_interface[i].path);
- safe_free(p->usb_interface[i].endpoint);
+ free(p->usb_interface[i].path);
+ free(p->usb_interface[i].endpoint);
}
}