Changeset 782a3ce in mainline


Ignore:
Timestamp:
2020-05-04T20:41:31Z (4 years ago)
Author:
Manuele Conti <manuele.conti@…>
Parents:
14a014f
Message:

Avoid memory leak in tinput_text_complete when realloc fails

File:
1 edited

Legend:

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

    r14a014f r782a3ce  
    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.