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

Changeset 265be8a in mainline


Ignore:
Timestamp:
2020-06-10T12:52:43Z (4 weeks ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
94e75cf
Parents:
dc69b5c
git-author:
Manuele Conti <manuele.conti@…> (2020-06-10 08:17:09)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2020-06-10 12:52:43)
Message:

Avoid memory leak when realloc fails in vol_get_ids_internal function

File:
1 edited

Legend:

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

    rdc69b5c r265be8a  
    168168
    169169                alloc_size = act_size;
    170                 ids = realloc(ids, alloc_size);
    171                 if (ids == NULL)
     170                service_id_t *temp = realloc(ids, alloc_size);
     171                if (temp == NULL) {
     172                        free(ids);
    172173                        return ENOMEM;
     174                }
     175                ids = temp;
    173176        }
    174177
Note: See TracChangeset for help on using the changeset viewer.