1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Added checking of return value from my_once_alloc() in charset

Added checking of return value from malloc() in reg_init()


client/mysqltest.c:
  Added comment
dbug/dbug.c:
  Removed not needed test
mysys/charset.c:
  Added checking of return value from my_once_alloc()
regex/reginit.c:
  Abort if out of memory in reg_init() (unlikely)
sql/item_strfunc.cc:
  Added comment
This commit is contained in:
unknown
2003-12-10 00:00:20 +02:00
parent 4e85bf326e
commit 6b97c26a29
5 changed files with 54 additions and 15 deletions

View File

@ -49,6 +49,16 @@ void regex_init()
for (i=0; i < CCLASS_LAST ; i++)
{
char *tmp=(char*) malloc(count[i]+1);
if (!tmp)
{
/*
This is very unlikely to happen as this function is called once
at program startup
*/
fprintf(stderr,
"Fatal error: Can't allocate memory in regex_init\n");
exit(1);
}
memcpy(tmp,buff[i],count[i]*sizeof(char));
tmp[count[i]]=0;
cclasses[i].chars=tmp;