From b9848ce99f13bdf07ab5e538422d83280a6fe321 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 20 Jun 2007 10:50:01 +0200 Subject: inotail.c: Add missing free() calls after lseek() failure --- inotail.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inotail.c b/inotail.c index 9bd7f21..5917d4a 100644 --- a/inotail.c +++ b/inotail.c @@ -145,6 +145,7 @@ static off_t lines_to_offset_from_end(struct file_struct *f, unsigned long n_lin if (lseek(f->fd, offset, SEEK_SET) == (off_t) -1) { fprintf(stderr, "Error: Could not seek in file '%s' (%s)\n", f->name, strerror(errno)); + free(buf); return -1; } @@ -187,6 +188,7 @@ static off_t lines_to_offset_from_begin(struct file_struct *f, unsigned long n_l if (lseek(f->fd, offset, SEEK_SET) == (off_t) -1) { fprintf(stderr, "Error: Could not seek in file '%s' (%s)\n", f->name, strerror(errno)); + free(buf); return -1; } @@ -314,6 +316,7 @@ static int tail_file(struct file_struct *f, unsigned long n_units, char mode, ch if (lseek(f->fd, offset, SEEK_SET) == (off_t) -1) { fprintf(stderr, "Error: Could not seek in file '%s' (%s)\n", f->name, strerror(errno)); + free(buf); return -1; } -- cgit v1.2.3-54-g00ecf