From: Christos Zoulas Date: Thu, 6 Oct 2011 14:27:16 +0000 (-0400) Subject: don't check for NULL before XFREE X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=792cf1da5351bba94d688db0413af0f8a635f33f;p=am-utils-6.2.git don't check for NULL before XFREE strdup -> xstrdup --- diff --git a/amd/amfs_nfsx.c b/amd/amfs_nfsx.c index 4f276f01..00f9b756 100644 --- a/amd/amfs_nfsx.c +++ b/amd/amfs_nfsx.c @@ -195,7 +195,10 @@ amfs_nfsx_init(mntfs *mf) char *pref; int error = 0; - info = strdup(mf->mf_info); + info = xstrdup(mf->mf_info); + if (info == NULL) + return errno; + host = strchr(info, ':'); if (!host) { error = EINVAL; @@ -251,18 +254,14 @@ amfs_nfsx_init(mntfs *mf) /* propagate the on_autofs flag */ nx->nx_v[i].n_mnt->mf_flags |= mf->mf_flags & MFF_ON_AUTOFS; } - if (rfs) - XFREE(rfs); - if (mp) - XFREE(mp); - if (xinfo) - XFREE(xinfo); + XFREE(rfs); + XFREE(mp); + XFREE(xinfo); } XFREE(ivec); errexit: - if (info) - XFREE(info); + XFREE(info); if (error) return error; }