don't check for NULL before XFREE
authorChristos Zoulas <christos@zoulas.com>
Thu, 6 Oct 2011 14:38:01 +0000 (10:38 -0400)
committerChristos Zoulas <christos@zoulas.com>
Thu, 6 Oct 2011 14:38:01 +0000 (10:38 -0400)
strdup -> xstrdup

amd/restart.c

index a30022714badfce515a35771c826cfbad8bd37bb..fa937d117f3bdcd479252d912ef68864dd34803b 100644 (file)
@@ -64,16 +64,16 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops)
   cp = strchr(me->mnt_fsname, ':');
   if (cp) {
     *cp = '\0';
-    mo.opt_rhost = strdup(me->mnt_fsname);
-    mo.opt_rfs = strdup(cp + 1);
+    mo.opt_rhost = xstrdup(me->mnt_fsname);
+    mo.opt_rfs = xstrdup(cp + 1);
     *cp = ':';
   } else if (STREQ(me->mnt_type, MNTTAB_TYPE_NFS)) {
     /*
      * Hacky workaround for mnttab NFS entries that only list the server
      */
     plog(XLOG_WARNING, "NFS server entry assumed to be %s:/", me->mnt_fsname);
-    mo.opt_rhost = strdup(me->mnt_fsname);
-    mo.opt_rfs = strdup("/");
+    mo.opt_rhost = xstrdup(me->mnt_fsname);
+    mo.opt_rfs = xstrdup("/");
     me->mnt_fsname = str3cat(me->mnt_fsname, mo.opt_rhost, ":", "/");
   }
   mo.opt_fs = me->mnt_dir;
@@ -109,10 +109,8 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops)
   /*
    * Clean up mo
    */
-  if (mo.opt_rhost)
-    XFREE(mo.opt_rhost);
-  if (mo.opt_rfs)
-    XFREE(mo.opt_rfs);
+  XFREE(mo.opt_rhost);
+  XFREE(mo.opt_rfs);
 }