- caller checks am_parent, so we check it too.
authorChristos Zoulas <christos@zoulas.com>
Thu, 6 Oct 2011 14:24:02 +0000 (10:24 -0400)
committerChristos Zoulas <christos@zoulas.com>
Thu, 6 Oct 2011 14:24:02 +0000 (10:24 -0400)
- strdup -> xstrdup

amd/amfs_auto.c

index 1376b4999553e2595731f3febba25e87918c87f9..6c62795c9654d0b2b6c07cfc4dddd614344b2f7a 100644 (file)
@@ -101,6 +101,8 @@ am_ops amfs_auto_ops =
 static int
 amfs_auto_mount(am_node *mp, mntfs *mf)
 {
+  if (mp->am_parent == NULL)
+    return EINVAL;
   /*
    * Pseudo-directories are used to provide some structure
    * to the automounted directories instead
@@ -131,12 +133,12 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
   if (mf->mf_fo->opt_pref) {
     /* allow pref:=null to set a real null prefix */
     if (STREQ(mf->mf_fo->opt_pref, "null")) {
-      mp->am_pref = strdup("");
+      mp->am_pref = xstrdup("");
     } else {
       /*
        * the prefix specified as an option
        */
-      mp->am_pref = strdup(mf->mf_fo->opt_pref);
+      mp->am_pref = xstrdup(mf->mf_fo->opt_pref);
     }
   } else {
     /*