diff options
author | Theodore Ts'o <tytso@mit.edu> | 2004-12-22 00:49:06 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2004-12-22 00:49:06 -0500 |
commit | c88bce8df0ecf511b0c63de6292f215d562860a2 (patch) | |
tree | ce8e61e3a28a23db3700ca623f57f308cf349e00 /misc/fsck.c | |
parent | 690e693cafa83eadbf7ce80291f53a7e89e9c2cc (diff) | |
download | e2fsprogs-c88bce8df0ecf511b0c63de6292f215d562860a2.tar.gz |
In fsck, check return from malloc of fsck_path, and print an error message
if it fails.
Diffstat (limited to 'misc/fsck.c')
-rw-r--r-- | misc/fsck.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/misc/fsck.c b/misc/fsck.c index da858677..b1e286a0 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -1221,6 +1221,10 @@ int main(int argc, char *argv[]) if (oldpath) { fsck_path = malloc (strlen (fsck_prefix_path) + 1 + strlen (oldpath) + 1); + if (!fsck_path) { + fprintf(stderr, "%s: Unable to allocate memory for fsck_path\n", progname); + exit(EXIT_ERROR); + } strcpy (fsck_path, fsck_prefix_path); strcat (fsck_path, ":"); strcat (fsck_path, oldpath); |