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

Changeset a25b496 in mainline


Ignore:
Timestamp:
2020-04-19T15:53:52Z (5 weeks ago)
Author:
Manuele Conti <manuele.conti@…>
Parents:
ec506d49
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

    rec506d49 ra25b496  
    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.