aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-06-02 08:05:43 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-06-02 08:07:44 -0400
commit85a5c8dabd2561dfe616bea50faf2549e8cb345e (patch)
tree919f22247b71c5562b3c1caff4f0bfa9dfcf0528 /common
parentaf87c7a1af8d790b819afe782fcff2830e959d58 (diff)
downloadsway-85a5c8dabd2561dfe616bea50faf2549e8cb345e.tar.xz
Fix infinite loop in peek_line for EOF blanks
Diffstat (limited to 'common')
-rw-r--r--common/readline.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/readline.c b/common/readline.c
index 46b96623..1c396a90 100644
--- a/common/readline.c
+++ b/common/readline.c
@@ -56,6 +56,8 @@ char *peek_line(FILE *file, int line_offset, long *position) {
for (int i = 0; i <= line_offset; i++) {
ssize_t read = getline(&line, &length, file);
if (read < 0) {
+ free(line);
+ line = NULL;
break;
}
if (read > 0 && line[read - 1] == '\n') {