Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 97cf049 in mainline


Ignore:
Timestamp:
2020-04-29T19:24:54Z (4 weeks ago)
Author:
Manuele Conti <manuele.conti@…>
Parents:
14a014f
git-author:
Manuele Conti <manuele.conti@…> (2020-04-29 19:20:50)
git-committer:
Manuele Conti <manuele.conti@…> (2020-04-29 19:24:54)
Message:

Avoid memory leak in range_get_str function on reallloc fails

File:
1 edited

Legend:

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

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