From 1d77c0412ee5875cefaf514df483af38c63356f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Dec 2003 13:24:16 +0100 Subject: Fixed various memory leaks. sql/sp.cc: Fixed memory leaks. Deletion of sps now in sp_cache. sql/sp_cache.cc: Fixed memory leaks. Use implicit delete of objects to make sure they're always freed. sql/sp_cache.h: Fixed memory leaks. Use implicit delete of objects to make sure they're always freed. sql/sp_head.cc: Fixed memory leaks. Make sure we use the right mem_root during parsing. sql/sp_head.h: Fixed memory leaks. Make sure we use the right mem_root during parsing. sql/sql_parse.cc: Fixed memory leaks. Don't forget to free the temporary object created at definition. sql/sql_yacc.yy: Fixed memory leaks. Make sure we use the right mem_root during parsing. --- sql/sp_cache.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sql/sp_cache.h') diff --git a/sql/sp_cache.h b/sql/sp_cache.h index 3d38d6f1d1f..da25227303b 100644 --- a/sql/sp_cache.h +++ b/sql/sp_cache.h @@ -37,8 +37,8 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp); /* Lookup an SP in cache */ sp_head *sp_cache_lookup(sp_cache **cp, char *name, uint namelen); -/* Remove an SP from cache */ -sp_head *sp_cache_remove(sp_cache **cp, char *name, uint namelen); +/* Remove an SP from cache. Returns true if something was removed */ +bool sp_cache_remove(sp_cache **cp, char *name, uint namelen); /* @@ -75,14 +75,17 @@ public: return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen); } - inline sp_head * + inline bool remove(char *name, uint namelen) { sp_head *sp= lookup(name, namelen); if (sp) + { hash_delete(&m_hashtable, (byte *)sp); - return sp; + return TRUE; + } + return FALSE; } inline void -- cgit v1.2.1