Changeset a2b890d in mainline for uspace/app/edit/edit.c


Ignore:
Timestamp:
2020-04-29T19:20:50Z (4 years ago)
Author:
Manuele Conti <manuele.conti@…>
Parents:
78193b36
Message:

Avoid memory leak in range_get_str function on reallloc fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/edit.c

    r78193b36 ra2b890d  
    791791
    792792                buf_size *= 2;
    793                 buf = realloc(buf, buf_size);
    794                 if (buf == NULL)
     793                char *tmp = realloc(buf, buf_size);
     794                if (tmp == NULL) {
     795                        free(buf);
    795796                        return NULL;
     797                }
     798                buf = tmp;
    796799        }
    797800
Note: See TracChangeset for help on using the changeset viewer.