Changeset b42fa76 in mainline


Ignore:
Timestamp:
2020-05-05T14:15:49Z (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:
698ce34c
Parents:
7d3a4ac
git-author:
Manuele Conti <manuele.conti@…> (2020-05-04 20:41:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2020-05-05 14:15:49)
Message:

Avoid memory leak in tinput_text_complete when realloc fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/clui/tinput.c

    r7d3a4ac rb42fa76  
    704704                        /* Extend array */
    705705                        compl_len = 2 * compl_len;
    706                         compl = realloc(compl, compl_len * sizeof(char *));
    707                         if (compl == NULL) {
     706                        char **temp = realloc(compl, compl_len * sizeof(char *));
     707                        if (temp == NULL) {
     708                                free(compl);
    708709                                printf("Error: Out of memory.\n");
    709710                                break;
    710711                        }
     712                        compl = temp;
    711713                }
    712714
Note: See TracChangeset for help on using the changeset viewer.