Changeset f019125a in mainline for uspace/drv/root/root/root.c


Ignore:
Timestamp:
2020-03-25T11:44:04Z (4 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:
823461d3
Parents:
4453a12a
git-author:
Manuele Conti <manuele.conti@…> (2020-03-24 22:12:22)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2020-03-25 11:44:04)
Message:

Avoid memory leak in add_platform_fun return with ENOMEM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/root/root/root.c

    r4453a12a rf019125a  
    144144
    145145        /* Null-terminate string. */
    146         platform = realloc(platform, platform_size + 1);
    147         if (platform == NULL) {
     146        char *tmp = realloc(platform, platform_size + 1);
     147        if (tmp == NULL) {
    148148                ddf_msg(LVL_ERROR, "Memory allocation failed.");
    149                 return ENOMEM;
    150         }
    151 
     149                free(platform);
     150                return ENOMEM;
     151        }
     152        platform = tmp;
    152153        platform[platform_size] = '\0';
    153154
Note: See TracChangeset for help on using the changeset viewer.