summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-06-20 10:50:01 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-06-20 10:50:01 +0200
commitb9848ce99f13bdf07ab5e538422d83280a6fe321 (patch)
treec191abd5cd14a8fbf3fd83e927d6afb74952272d
parentb054120a5cde828bf2ca54d434dfb7f12ea0bf01 (diff)
inotail.c: Add missing free() calls after lseek() failure
-rw-r--r--inotail.c3
1 files changed, 3 insertions, 0 deletions
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;
}