r12440: fix crash bugs
authorStefan Metzmacher <metze@samba.org>
Thu, 22 Dec 2005 22:03:25 +0000 (22:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:47:39 +0000 (13:47 -0500)
metze

source/nbt_server/interfaces.c
source/nbt_server/wins/winsclient.c

index 4ef2afb8ee5afc2e66a016cdefbbfb64b6efcd68..f2ccc1c424bb4e9e5daa4aa0abbe7ee99c94fd77 100644 (file)
@@ -279,6 +279,9 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx
                if (ret[count] == NULL) goto failed;
                count++;
        }
                if (ret[count] == NULL) goto failed;
                count++;
        }
+
+       if (ret == NULL) goto failed;
+
        ret[count] = NULL;
        return ret;
 
        ret[count] = NULL;
        return ret;
 
index fdfdc8f0ed94c62e31345e09fa9e65ee52747409..6bf328d1466edebb9f09e40c4a57a262a6c134cd 100644 (file)
@@ -127,6 +127,11 @@ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te,
        io.in.nb_flags        = iname->nb_flags;
        io.in.ttl             = iname->ttl;
 
        io.in.nb_flags        = iname->nb_flags;
        io.in.ttl             = iname->ttl;
 
+       if (!io.in.addresses) {
+               talloc_free(tmp_ctx);
+               return;
+       }
+
        c = nbt_name_refresh_wins_send(wins_socket(iface), &io);
        if (c == NULL) {
                talloc_free(tmp_ctx);
        c = nbt_name_refresh_wins_send(wins_socket(iface), &io);
        if (c == NULL) {
                talloc_free(tmp_ctx);
@@ -218,6 +223,10 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname)
        io.in.nb_flags        = iname->nb_flags;
        io.in.ttl             = iname->ttl;
 
        io.in.nb_flags        = iname->nb_flags;
        io.in.ttl             = iname->ttl;
 
+       if (!io.in.addresses) {
+               return;
+       }
+
        c = nbt_name_register_wins_send(wins_socket(iface), &io);
        if (c == NULL) {
                talloc_free(io.in.addresses);
        c = nbt_name_register_wins_send(wins_socket(iface), &io);
        if (c == NULL) {
                talloc_free(io.in.addresses);