summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-23 02:52:36 +0000
committerJeremy Allison <jra@samba.org>2002-11-23 02:52:36 +0000
commitde474974ea25df7738dd175126e3f1de0df47ea6 (patch)
treeb9d41afb7e5c64a91fb5538c05e9d3358909c386 /source3/nmbd
parent46d5c060c60753b94ae97ccd48aa7a8be791feed (diff)
downloadsamba-de474974ea25df7738dd175126e3f1de0df47ea6.tar.gz
samba-de474974ea25df7738dd175126e3f1de0df47ea6.tar.bz2
samba-de474974ea25df7738dd175126e3f1de0df47ea6.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 5d5762d1787db4392d2dff16024097c638b2d494)
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);
}