summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-23 02:52:38 +0000
committerJeremy Allison <jra@samba.org>2002-11-23 02:52:38 +0000
commitf023d6129b7bf0d972f2bb9ecc025d316e55c8ae (patch)
tree753324d5e143411d4859ec5bb969ff98dfeba320 /source3/nmbd
parent823f8507cb209235e2efc7e19870c5d55b776d4d (diff)
downloadsamba-f023d6129b7bf0d972f2bb9ecc025d316e55c8ae.tar.gz
samba-f023d6129b7bf0d972f2bb9ecc025d316e55c8ae.tar.bz2
samba-f023d6129b7bf0d972f2bb9ecc025d316e55c8ae.zip
Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>. Jeremy. (This used to be commit 19f86f1f72aca924e9e320e20a175b5d21de45ad)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_winsserver.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index d67d25bb88..87391b35df 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -266,7 +266,8 @@ BOOL initialise_wins(void)
continue;
dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr) continue;
+ if (!dbuf.dptr)
+ continue;
fstrcpy(name_type, kbuf.dptr+strlen(ENTRY_PREFIX));
@@ -284,15 +285,20 @@ BOOL initialise_wins(void)
wins_ip=*interpret_addr2(ip_str);
/* Don't reload replica records */
- if (!ip_equal(wins_ip, our_fake_ip))
+ if (!ip_equal(wins_ip, our_fake_ip)) {
+ SAFE_FREE(dbuf.dptr);
continue;
+ }
/* Don't reload released or tombstoned records */
- if ((wins_flags&WINS_STATE_MASK) != WINS_ACTIVE)
+ if ((wins_flags&WINS_STATE_MASK) != WINS_ACTIVE) {
+ SAFE_FREE(dbuf.dptr);
continue;
+ }
/* Allocate the space for the ip_list. */
if((ip_list = (struct in_addr *)malloc( num_ips * sizeof(struct in_addr))) == NULL) {
+ SAFE_FREE(dbuf.dptr);
DEBUG(0,("initialise_wins: Malloc fail !\n"));
return False;
}
@@ -324,6 +330,7 @@ BOOL initialise_wins(void)
name, type, ttl, inet_ntoa(ip_list[0]), nb_flags));
}
+ SAFE_FREE(dbuf.dptr);
SAFE_FREE(ip_list);
}