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

Changeset 2a09dcb in mainline


Ignore:
Timestamp:
2020-04-21T14:04:08Z (5 weeks ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
14a014f, 85c98af, a43febeb
Parents:
11e4856
git-author:
Manuele Conti <manuele.conti@…> (2020-04-19 15:53:52)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2020-04-21 14:04:08)
Message:

Avoid memory leak in loc_get_ids_internal function on realloc fails

File:
1 edited

Legend:

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

    r11e4856 r2a09dcb  
    819819
    820820                alloc_size = act_size;
    821                 ids = realloc(ids, alloc_size);
    822                 if (ids == NULL)
     821                service_id_t *tmp = realloc(ids, alloc_size);
     822                if (tmp == NULL) {
     823                        free(ids);
    823824                        return ENOMEM;
     825                }
     826                ids = tmp;
    824827        }
    825828
Note: See TracChangeset for help on using the changeset viewer.