summaryrefslogtreecommitdiff
path: root/sql/sp_cache.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-08-09 10:09:11 +0000
committerunknown <sergefp@mysql.com>2005-08-09 10:09:11 +0000
commit08cadd816e7fd92f6f56c3ba621aa81d47954fca (patch)
tree77fb10df1ff1a3d56074c7f6375c1ce32bbe7c4d /sql/sp_cache.cc
parent502e97f875d448bcf0c0be4b2cd2c83733150427 (diff)
downloadmariadb-git-08cadd816e7fd92f6f56c3ba621aa81d47954fca.tar.gz
BUG#12228: Pre-review fixes: Fix coding style, handle the case when we're out of memory.
Diffstat (limited to 'sql/sp_cache.cc')
-rw-r--r--sql/sp_cache.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index 135000d1443..1763432f2bc 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -111,6 +111,11 @@ void sp_cache_clear(sp_cache **cp)
sp_cache_insert()
cp The cache to put routine into
sp Routine to insert.
+
+ TODO: Perhaps it will be more straightforward if in case we returned an
+ error from this function when we couldn't allocate sp_cache. (right
+ now failure to put routine into cache will cause a 'SP not found'
+ error to be reported at some later time)
*/
void sp_cache_insert(sp_cache **cp, sp_head *sp)
@@ -124,11 +129,13 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp)
pthread_mutex_lock(&Cversion_lock); // LOCK
v= Cversion;
pthread_mutex_unlock(&Cversion_lock); // UNLOCK
- c->version= v;
+ if (c)
+ c->version= v;
}
if (c)
{
- DBUG_PRINT("info",("sp_cache: inserting: %*s", sp->m_qname.length, sp->m_qname.str));
+ DBUG_PRINT("info",("sp_cache: inserting: %*s", sp->m_qname.length,
+ sp->m_qname.str));
c->insert(sp);
if (*cp == NULL)
*cp= c;