diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-04-23 07:40:13 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-04-23 07:40:13 +0000 |
commit | 062d79bf8ba5308803393c7b9140d1f77db3690f (patch) | |
tree | b049c56adf6025a2f7a8addd3b25086fdb1360b5 /source/smbd/mangle.c | |
parent | be7186b0dd2779fc9f98b4c9f77874ef3ded37d6 (diff) | |
download | samba-062d79bf8ba5308803393c7b9140d1f77db3690f.tar.gz samba-062d79bf8ba5308803393c7b9140d1f77db3690f.tar.xz samba-062d79bf8ba5308803393c7b9140d1f77db3690f.zip |
avoided a memory leak in the ubi code by deleting a mangled cache
entry before adding to ensure that we don't ever add a duplicate entry
this code can be removed when ubi gets fixed
Diffstat (limited to 'source/smbd/mangle.c')
-rw-r--r-- | source/smbd/mangle.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/smbd/mangle.c b/source/smbd/mangle.c index e47bcd896f6..8ac91d49c81 100644 --- a/source/smbd/mangle.c +++ b/source/smbd/mangle.c @@ -465,7 +465,8 @@ static signed int cache_compare( ubi_btItemPtr ItemPtr, ubi_btNodePtr NodePtr ) */ static void cache_free_entry( ubi_trNodePtr WarrenZevon ) { - free( WarrenZevon ); + ZERO_STRUCTP(WarrenZevon); + free( WarrenZevon ); } /* cache_free_entry */ /* ************************************************************************** ** @@ -575,6 +576,15 @@ static void cache_mangled_name( char *mangled_name, char *raw_name ) s2 = (char *)&(s1[mangled_len + 1]); (void)StrnCpy( s1, mangled_name, mangled_len ); (void)StrnCpy( s2, raw_name, raw_len ); + + /* possibly delete an old entry - this avoids a memory leak in the + ubi code to do with overwriting existing entries. + + remove this test when ubi gets fixed */ + if (ubi_cacheGet(mangled_cache, s1)) { + ubi_cacheDelete(mangled_cache, s1); + } + ubi_cachePut( mangled_cache, i, new_entry, s1 ); } /* cache_mangled_name */ |