summaryrefslogtreecommitdiff
path: root/source3/tdb
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/tdb
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/tdb')
-rw-r--r--source3/tdb/tdbutil.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c
index 5498872f8a..12db8b337f 100644
--- a/source3/tdb/tdbutil.c
+++ b/source3/tdb/tdbutil.c
@@ -139,9 +139,11 @@ int32 tdb_fetch_int32_byblob(TDB_CONTEXT *tdb, char *keyval, size_t len)
key.dptr = keyval;
key.dsize = len;
data = tdb_fetch(tdb, key);
- if (!data.dptr || data.dsize != sizeof(int32))
+ if (!data.dptr || data.dsize != sizeof(int32)) {
+ SAFE_FREE(data.dptr);
return -1;
-
+ }
+
ret = IVAL(data.dptr,0);
SAFE_FREE(data.dptr);
return ret;
@@ -198,9 +200,11 @@ BOOL tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, char *keyval, size_t len, uint32
key.dptr = keyval;
key.dsize = len;
data = tdb_fetch(tdb, key);
- if (!data.dptr || data.dsize != sizeof(uint32))
+ if (!data.dptr || data.dsize != sizeof(uint32)) {
+ SAFE_FREE(data.dptr);
return False;
-
+ }
+
*value = IVAL(data.dptr,0);
SAFE_FREE(data.dptr);
return True;