Changeset 0eea807 in mainline


Ignore:
Timestamp:
2023-10-22T13:56:55Z (13 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1502c05
Parents:
f5762c7
git-author:
Vojtech Horky <vojtech.horky@…> (2023-07-24 16:30:23)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-22 13:56:55)
Message:

Remove memory leak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/wifi_supplicant/wifi_supplicant.c

    rf5762c7 r0eea807  
    7575}
    7676
    77 static char *nic_addr_format(nic_address_t *addr)
    78 {
    79         char *str;
    80         int rc = asprintf(&str, "%02x:%02x:%02x:%02x:%02x:%02x",
     77static void nic_addr_format(nic_address_t *addr, char *out, size_t out_size)
     78{
     79        snprintf(out, out_size, "%02x:%02x:%02x:%02x:%02x:%02x",
    8180            addr->address[0], addr->address[1], addr->address[2],
    8281            addr->address[3], addr->address[4], addr->address[5]);
    83 
    84         if (rc < 0)
    85                 return NULL;
    86 
    87         return str;
    8882}
    8983
     
    263257        for (uint8_t i = 0; i < scan_results.length; i++) {
    264258                ieee80211_scan_result_t result = scan_results.results[i];
     259                char mac_addr_hex[18];
     260                nic_addr_format(&result.bssid, mac_addr_hex, 18);
    265261
    266262                printf("%16.16s %17s %4d %5s %5s %7s %7s\n",
    267                     result.ssid, nic_addr_format(&result.bssid),
     263                    result.ssid, mac_addr_hex,
    268264                    result.channel,
    269265                    enum_name(ieee80211_security_type_strs, result.security.type),
Note: See TracChangeset for help on using the changeset viewer.