diff options
author | lbonn <bonnans.l@gmail.com> | 2019-09-07 23:41:33 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-11-01 12:18:09 -0400 |
commit | a6307aed0089a35b5594f910c9604262b46832e6 (patch) | |
tree | 4cab6ca6b96b6cabfe224996fc3e8747e4e51272 /sway/config.c | |
parent | seat: simplify a strdup (diff) | |
download | sway-a6307aed0089a35b5594f910c9604262b46832e6.tar.gz sway-a6307aed0089a35b5594f910c9604262b46832e6.tar.zst sway-a6307aed0089a35b5594f910c9604262b46832e6.zip |
Fix various memory leaks
Found with clang-tidy
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index bb5b920b..afc60a42 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -687,8 +687,10 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file, | |||
687 | nread += next_nread - 2; | 687 | nread += next_nread - 2; |
688 | if ((ssize_t) *line_size < nread + 1) { | 688 | if ((ssize_t) *line_size < nread + 1) { |
689 | *line_size = nread + 1; | 689 | *line_size = nread + 1; |
690 | char *old_ptr = *lineptr; | ||
690 | *lineptr = realloc(*lineptr, *line_size); | 691 | *lineptr = realloc(*lineptr, *line_size); |
691 | if (!*lineptr) { | 692 | if (!*lineptr) { |
693 | free(old_ptr); | ||
692 | nread = -1; | 694 | nread = -1; |
693 | break; | 695 | break; |
694 | } | 696 | } |