summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/ChangeLog4
-rw-r--r--misc/fsck.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 8341d472..bf7a8c85 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,7 @@
+2007-03-28 Theodore Tso <tytso@mit.edu>
+
+ * fsck.c (execute): Fix memory leak on error paths
+
2007-03-21 Theodore Tso <tytso@mit.edu>
* e2image.c (output_meta_data_blocks, write_raw_image_file): Fix
diff --git a/misc/fsck.c b/misc/fsck.c
index 06ee02b3..1dcac259 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -470,6 +470,7 @@ static int execute(const char *type, const char *device, const char *mntpt,
s = find_fsck(prog);
if (s == NULL) {
fprintf(stderr, _("fsck: %s: not found\n"), prog);
+ free(inst);
return ENOENT;
}
@@ -486,12 +487,14 @@ static int execute(const char *type, const char *device, const char *mntpt,
pid = -1;
else if ((pid = fork()) < 0) {
perror("fork");
+ free(inst);
return errno;
} else if (pid == 0) {
if (!interactive)
close(0);
(void) execv(s, argv);
perror(argv[0]);
+ free(inst);
exit(EXIT_ERROR);
}