From: Eric Sandeen Date: Sat, 26 Jan 2013 22:40:30 +0000 (+0000) Subject: xfs_fsr: check strdup results properly in initallfs() X-Git-Tag: v3.1.11~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=758bcc928858b85743d2f466f41c80cb40b93214;p=thirdparty%2Fxfsprogs-dev.git xfs_fsr: check strdup results properly in initallfs() initallfs() does 2 strdups, but then checks the result of one of them twice, rather then checking each one. Fix this. Signed-off-by: Eric Sandeen Reviewed-by: Mark Tinguely Signed-off-by: Mark Tinguely --- diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index 843f57d70..b5aa3db76 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -470,10 +470,14 @@ initallfs(char *mtab) fs->dev = strdup(mp->mnt_fsname); fs->mnt = strdup(mp->mnt_dir); - if (fs->mnt == NULL || fs->mnt == NULL) { + if (fs->dev == NULL) { fsrprintf(_("strdup(%s) failed\n"), mp->mnt_fsname); exit(1); } + if (fs->mnt == NULL) { + fsrprintf(_("strdup(%s) failed\n"), mp->mnt_dir); + exit(1); + } mi++; fs++; }