diff options
-rw-r--r-- | lib/io/src/get_line.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/io/src/get_line.c b/lib/io/src/get_line.c index 1159037..e23383c 100644 --- a/lib/io/src/get_line.c +++ b/lib/io/src/get_line.c @@ -49,7 +49,7 @@ int istream_get_line(istream_t *strm, char **out, for (;;) { if (istream_precache(strm)) - return -1; + goto fail_free; if (strm->buffer_used == 0) { if (line_len == 0) @@ -111,6 +111,7 @@ int istream_get_line(istream_t *strm, char **out, fail_errno: fprintf(stderr, "%s: " PRI_SZ ": %s.\n", strm->get_filename(strm), *line_num, strerror(errno)); +fail_free: free(line); *out = NULL; return -1; |