Changeset 692fb976 in mainline


Ignore:
Timestamp:
2020-06-10T08:17:09Z (4 years ago)
Author:
Manuele Conti <manuele.conti@…>
Parents:
dc69b5c
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 r692fb976  
    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.