diff options
author | monty@mysql.com <> | 2003-12-10 00:00:20 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2003-12-10 00:00:20 +0200 |
commit | 6a95123971edb494e33330ed51d00a369293c60e (patch) | |
tree | 3974a0549628cd8fca7b70530e3d0443783de374 /regex/reginit.c | |
parent | e82018e34f6be6824ec72b461a472250c2acdb47 (diff) | |
download | mariadb-git-6a95123971edb494e33330ed51d00a369293c60e.tar.gz |
Added checking of return value from my_once_alloc() in charset
Added checking of return value from malloc() in reg_init()
Diffstat (limited to 'regex/reginit.c')
-rw-r--r-- | regex/reginit.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/regex/reginit.c b/regex/reginit.c index 18647c386fc..309685fadf2 100644 --- a/regex/reginit.c +++ b/regex/reginit.c @@ -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; |