diff options
author | Jeremy Allison <jra@samba.org> | 2002-11-23 02:52:38 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-11-23 02:52:38 +0000 |
commit | f023d6129b7bf0d972f2bb9ecc025d316e55c8ae (patch) | |
tree | 753324d5e143411d4859ec5bb969ff98dfeba320 /source3/tdb | |
parent | 823f8507cb209235e2efc7e19870c5d55b776d4d (diff) | |
download | samba-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/tdb')
-rw-r--r-- | source3/tdb/tdbutil.c | 12 |
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; |