mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
Add my_str_malloc and _free function pointers to strings library
which will by default exit(1) if malloc() fails, but can be set to do something else by the calling program does, which mysqld does to use my_malloc(..., MYF(MY_FAE)) instead. Also checks allocation in conf_to_src utility program. (Bug #7003)
This commit is contained in:
parent
539d63d09a
commit
409592e652
17 changed files with 113 additions and 10 deletions
|
|
@ -541,7 +541,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
tc1= buf;
|
||||
if ((len1 + len2 +2) > (int) sizeof(buf))
|
||||
tc1= (uchar*) malloc(len1+len2+2);
|
||||
tc1= (uchar*) my_str_malloc(len1+len2+2);
|
||||
tc2= tc1 + len1+1;
|
||||
memcpy((char*) tc1, (char*) s1, len1);
|
||||
tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */
|
||||
|
|
@ -551,7 +551,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
|
|||
thai2sortable(tc2, len2);
|
||||
i= strcmp((char*)tc1, (char*)tc2);
|
||||
if (tc1 != buf)
|
||||
free(tc1);
|
||||
my_str_free(tc1);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -572,7 +572,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
|||
|
||||
a= buf;
|
||||
if ((a_length + b_length +2) > (int) sizeof(buf))
|
||||
alloced= a= (uchar*) malloc(a_length+b_length+2);
|
||||
alloced= a= (uchar*) my_str_malloc(a_length+b_length+2);
|
||||
|
||||
b= a + a_length+1;
|
||||
memcpy((char*) a, (char*) a0, a_length);
|
||||
|
|
@ -621,7 +621,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
|||
ret:
|
||||
|
||||
if (alloced)
|
||||
free(alloced);
|
||||
my_str_free(alloced);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue