From 39a8d048c80f01ee37a65626da723ad9167120e2 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Thu, 6 Oct 2011 10:29:23 -0400 Subject: [PATCH] caller checks for am_al, we do too. don't check for NULL before XFREE strdup -> xstrdup --- amd/autil.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/amd/autil.c b/amd/autil.c index edc28bf3..43e30286 100644 --- a/amd/autil.c +++ b/amd/autil.c @@ -355,6 +355,11 @@ assign_error_mntfs(am_node *mp) { int error; dlog("assign_error_mntfs"); + + if (mp->am_al == NULL) { + plog(XLOG_ERROR, "%s: Can't assign error", __func__); + return; + } /* * Save the old error code */ @@ -715,7 +720,7 @@ am_unmounted(am_node *mp) clocktime(&mp->am_parent->am_fattr.na_mtime); if (mp->am_parent && (mp->am_flags & AMF_REMOUNT)) { - char *fname = strdup(mp->am_name); + char *fname = xstrdup(mp->am_name); am_node *mp_parent = mp->am_parent; mntfs *mf_parent = mp_parent->am_al->al_mnt; am_node fake_mp; @@ -732,7 +737,7 @@ am_unmounted(am_node *mp) plog(XLOG_INFO, "am_unmounted: remounting %s", fname); mp = mf_parent->mf_ops->lookup_child(mp_parent, fname, &error, VLOOK_CREATE); if (mp && error < 0) - mp = mf_parent->mf_ops->mount_child(mp, &error); + (void)mf_parent->mf_ops->mount_child(mp, &error); if (error > 0) { errno = error; plog(XLOG_ERROR, "am_unmounted: could not remount %s: %m", fname); -- 2.43.0