]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/export/client.c
libexport.a: Allow m_hostname allocation to fail instead of exit
[nfs-utils.git] / support / export / client.c
index 8f83da31526a6e1f21e59a7d8c9718703b4a5a79..20d662af0c4efe69fe09a0456468b0d2b6f9605e 100644 (file)
@@ -55,7 +55,7 @@ init_addrlist(nfs_client *clp, const struct hostent *hp)
 static void
 client_free(nfs_client *clp)
 {
-       xfree(clp->m_hostname);
+       free(clp->m_hostname);
        xfree(clp);
 }
 
@@ -154,11 +154,9 @@ client_dup(nfs_client *clp, struct hostent *hp)
 static int
 client_init(nfs_client *clp, const char *hname, struct hostent *hp)
 {
-       xfree(clp->m_hostname);
-       if (hp)
-               clp->m_hostname = xstrdup(hp->h_name);
-       else
-               clp->m_hostname = xstrdup(hname);
+       clp->m_hostname = strdup(hname);
+       if (clp->m_hostname == NULL)
+               return 0;
 
        clp->m_exported = 0;
        clp->m_count = 0;