Put extra check in hashtable_fetch to return if zero entries (should never happen but will crash if not checked); remove dcb_close from mysql_backend where it closes backend DCBs, as these should be closed by the router.

This commit is contained in:
counterpoint
2015-10-07 17:06:21 +01:00
parent 5c985b42ba
commit bb53eb0f6d
2 changed files with 14 additions and 3 deletions

View File

@ -379,7 +379,7 @@ hashtable_fetch(HASHTABLE *table, void *key)
unsigned int hashkey;
HASHENTRIES *entry;
if(table == NULL || key == NULL)
if(table == NULL || key == NULL || 0 == table->hashsize)
return NULL;
hashkey = table->hashfn(key) % table->hashsize;

View File

@ -44,6 +44,7 @@
* 24/10/2014 Massimiliano Pinto Added Mysql user@host @db authentication support
* 10/11/2014 Massimiliano Pinto Client charset is passed to backend
* 19/06/2015 Martin Brampton Persistent connection handling
* 07/10/2015 Martin Brampton Remove calls to dcb_close - should be done by routers
*
*/
#include <modinfo.h>
@ -408,7 +409,12 @@ static int gw_read_backend_event(DCB *dcb) {
{
gwbuf_free(errbuf);
dcb->dcb_errhandle_called = true;
dcb_close(dcb);
/*
* I'm pretty certain this is best removed and
* causes trouble if present, but have left it
* here just for now as a comment. Martin
*/
/* dcb_close(dcb); */
rc = 1;
goto return_rc;
}
@ -1129,7 +1135,12 @@ gw_backend_hangup(DCB *dcb)
}
}
gwbuf_free(errbuf);
dcb_close(dcb);
/*
* I'm pretty certain this is best removed and
* causes trouble if present, but have left it
* here just for now as a comment. Martin
*/
/* dcb_close(dcb); */
goto retblock;
}
#if defined(SS_DEBUG)