Changeset e7dc3a4 in mainline


Ignore:
Timestamp:
2023-07-24T16:22:54Z (12 months ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
ticket/834-toolchain-update
Children:
417e1f6
Parents:
d3d267b
git-author:
Vojtech Horky <vojtech.horky@…> (2023-07-24 16:18:23)
git-committer:
Vojtech Horky <vojtech.horky@…> (2023-07-24 16:22:54)
Message:

Prevent double-free

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/wmi.c

    rd3d267b re7dc3a4  
    245245            host2uint16_t_be(++htc_device->sequence_number);
    246246
    247         /* Send message. */
     247        /* Send message (buffer will not be needed afterwards regardless of result). */
    248248        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    249249            htc_device->endpoints.wmi_endpoint);
    250         if (rc != EOK) {
    251                 free(buffer);
     250        free(buffer);
     251        if (rc != EOK) {
    252252                usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc));
    253253                return rc;
    254254        }
    255 
    256         free(buffer);
    257255
    258256        bool clean_resp_buffer = false;
     
    271269                    response_buffer_size, NULL);
    272270                if (rc != EOK) {
    273                         free(buffer);
    274271                        usb_log_error("Failed to receive WMI message response. "
    275272                            "Error: %s\n", str_error_name(rc));
     
    279276                if (response_buffer_size < sizeof(htc_frame_header_t) +
    280277                    sizeof(wmi_command_header_t)) {
    281                         free(buffer);
    282278                        usb_log_error("Corrupted response received.\n");
    283279                        return EINVAL;
Note: See TracChangeset for help on using the changeset viewer.