Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 77592a76 in mainline


Ignore:
Timestamp:
2020-05-04T21:12:16Z (3 weeks ago)
Author:
Manuele Conti <manuele.conti@…>
Parents:
14a014f
Message:

Avoid memory leak in pci_get_ids_internal on realloc fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/pci.c

    r14a014f r77592a76  
    163163
    164164                alloc_size = act_size;
    165                 ids = realloc(ids, alloc_size);
    166                 if (ids == NULL)
     165                service_id_t *tmp = realloc(ids, alloc_size);
     166                if (tmp == NULL) {
     167                        free(ids);
    167168                        return ENOMEM;
     169                }
     170                ids = tmp;
    168171        }
    169172
Note: See TracChangeset for help on using the changeset viewer.