]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/statd/notlist.c
statd: add nsm_present_address() API
[nfs-utils.git] / utils / statd / notlist.c
index 98aa6e2fa3a2571871f148cef70e27e284076db7..de7d0465e60877300ba2cbf30a40516a6484f154 100644 (file)
@@ -17,7 +17,6 @@
 #endif
 
 #include <string.h>
-#include "misc.h"
 #include "statd.h"
 #include "notlist.h"
 
@@ -54,19 +53,13 @@ nlist_new(char *my_name, char *mon_name, int state)
 {
        notify_list     *new;
 
-       if (!(new = (notify_list *) xmalloc(sizeof(notify_list))))
-               return NULL;
+       new = (notify_list *) xmalloc(sizeof(notify_list));
        memset(new, 0, sizeof(*new));
 
        NL_TIMES(new) = MAX_TRIES;
        NL_STATE(new) = state;
-       if (!(NL_MY_NAME(new) = xstrdup(my_name))
-           || !(NL_MON_NAME(new) = xstrdup(mon_name))) {
-               if (NL_MY_NAME(new))
-                       free(NL_MY_NAME(new));
-               free(new);
-               return NULL;
-       }
+       NL_MY_NAME(new) = xstrdup(my_name);
+       NL_MON_NAME(new) = xstrdup(mon_name);
 
        return new;
 }
@@ -217,6 +210,7 @@ nlist_free(notify_list **head, notify_list *entry)
                free(NL_MY_NAME(entry));
        if (NL_MON_NAME(entry))
                free(NL_MON_NAME(entry));
+       free(entry->dns_name);
        free(entry);
 }
 
@@ -239,7 +233,8 @@ nlist_gethost(notify_list *list, char *host, int myname)
        notify_list     *lp;
 
        for (lp = list; lp; lp = lp->next) {
-               if (matchhostname(host, myname? NL_MY_NAME(lp) : NL_MON_NAME(lp)))
+               if (statd_matchhostname(host,
+                               myname? NL_MY_NAME(lp) : NL_MON_NAME(lp)))
                        return lp;
        }