mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
Fix various memory leaks
Found with clang-tidy
This commit is contained in:
parent
32caabc7a1
commit
a6307aed00
3 changed files with 11 additions and 4 deletions
|
|
@ -687,8 +687,10 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file,
|
|||
nread += next_nread - 2;
|
||||
if ((ssize_t) *line_size < nread + 1) {
|
||||
*line_size = nread + 1;
|
||||
char *old_ptr = *lineptr;
|
||||
*lineptr = realloc(*lineptr, *line_size);
|
||||
if (!*lineptr) {
|
||||
free(old_ptr);
|
||||
nread = -1;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue