Changeset dc5c303 in mainline for uspace/drv/nic


Ignore:
Timestamp:
2023-12-28T13:59:23Z (22 months ago)
Author:
GitHub <noreply@…>
Children:
6b66de6b
Parents:
42c2e65 (diff), f87ff8e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2023-12-28 13:59:23)
git-committer:
GitHub <noreply@…> (2023-12-28 13:59:23)
Message:

Merge branch 'master' into topic/packet-capture

File:
1 edited

Legend:

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

    r42c2e65 rdc5c303  
    230230        size_t buffer_size = header_size + command_length;
    231231        void *buffer = malloc(buffer_size);
     232        if (buffer == NULL) {
     233                usb_log_error("Failed to allocate WMI message buffer (out of memory).\n");
     234                return ENOMEM;
     235        }
    232236
    233237        if (command_buffer != NULL)
     
    241245            host2uint16_t_be(++htc_device->sequence_number);
    242246
    243         /* Send message. */
     247        /* Send message (buffer will not be needed afterwards regardless of result). */
    244248        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    245249            htc_device->endpoints.wmi_endpoint);
    246         if (rc != EOK) {
    247                 free(buffer);
     250        free(buffer);
     251        if (rc != EOK) {
    248252                usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc));
    249253                return rc;
    250254        }
    251 
    252         free(buffer);
    253255
    254256        bool clean_resp_buffer = false;
     
    267269                    response_buffer_size, NULL);
    268270                if (rc != EOK) {
    269                         free(buffer);
    270271                        usb_log_error("Failed to receive WMI message response. "
    271272                            "Error: %s\n", str_error_name(rc));
     
    275276                if (response_buffer_size < sizeof(htc_frame_header_t) +
    276277                    sizeof(wmi_command_header_t)) {
    277                         free(buffer);
    278278                        usb_log_error("Corrupted response received.\n");
    279279                        return EINVAL;
Note: See TracChangeset for help on using the changeset viewer.