diff options
author | Simo Sorce <idra@samba.org> | 2001-07-03 00:23:38 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-07-03 00:23:38 +0000 |
commit | 89ee12d37399ac77f3532f9dfee5e52b7359f552 (patch) | |
tree | 65425ca9de2b8c240eb7c3db82b014b3cd146590 /source3 | |
parent | d6d9375efd9baf3eefc8550e5f4b964914597511 (diff) | |
download | samba-89ee12d37399ac77f3532f9dfee5e52b7359f552.tar.gz samba-89ee12d37399ac77f3532f9dfee5e52b7359f552.tar.bz2 samba-89ee12d37399ac77f3532f9dfee5e52b7359f552.zip |
- sorry, forgot to test a pointer
(This used to be commit 1aef52245229741bc24c3e8147fa86eaa20fe9b2)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nmbd/nmbd.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 2969c332d5..8a6bf383d1 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -569,8 +569,10 @@ static BOOL init_structs(void) */ /* Work out the max number of netbios aliases that we have */ ptr = lp_netbios_aliases(); - for( namecount=0; *ptr; namecount++,ptr++ ) - ; + namecount = 0; + if (ptr) + for( ; *ptr; namecount++,ptr++ ) + ; if ( *global_myname ) namecount++; @@ -588,28 +590,31 @@ static BOOL init_structs(void) my_netbios_names[namecount++] = global_myname; ptr = lp_netbios_aliases(); - while ( *ptr ) + if (ptr) { - nbname = strdup(*ptr); - if (nbname == NULL) + while ( *ptr ) { - DEBUG(0,("init_structs: malloc fail when allocating names.\n")); - return False; + nbname = strdup(*ptr); + if (nbname == NULL) + { + DEBUG(0,("init_structs: malloc fail when allocating names.\n")); + return False; + } + strupper( nbname ); + /* Look for duplicates */ + nodup=1; + for( n=0; n<namecount; n++ ) + { + if( 0 == strcmp( nbname, my_netbios_names[n] ) ) + nodup=0; + } + if (nodup) + my_netbios_names[namecount++] = nbname; + else + free(nbname); + + ptr++; } - strupper( nbname ); - /* Look for duplicates */ - nodup=1; - for( n=0; n<namecount; n++ ) - { - if( 0 == strcmp( nbname, my_netbios_names[n] ) ) - nodup=0; - } - if (nodup) - my_netbios_names[namecount++] = nbname; - else - free(nbname); - - ptr++; } /* Terminate name list */ |