Changeset 7d3a4ac in mainline


Ignore:
Timestamp:
2020-05-05T14:14:41Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b42fa76
Parents:
18c2e87
git-author:
Manuele Conti <manuele.conti@…> (2020-05-04 21:12:16)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2020-05-05 14:14:41)
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

    r18c2e87 r7d3a4ac  
    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.