Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6a951239
Commit
6a951239
authored
Dec 10, 2003
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added checking of return value from my_once_alloc() in charset
Added checking of return value from malloc() in reg_init()
parent
e82018e3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
16 deletions
+55
-16
client/mysqltest.c
client/mysqltest.c
+1
-0
dbug/dbug.c
dbug/dbug.c
+1
-1
mysys/charset.c
mysys/charset.c
+39
-15
regex/reginit.c
regex/reginit.c
+10
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+4
-0
No files found.
client/mysqltest.c
View file @
6a951239
...
...
@@ -2302,6 +2302,7 @@ static VAR* var_init(VAR* v, const char* name, int name_len, const char* val,
if
(
!
(
tmp_var
->
str_val
=
my_malloc
(
val_alloc_len
+
1
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
/* 'name' may be NULL here, but in this case name_len is 0 */
memcpy
(
tmp_var
->
name
,
name
,
name_len
);
if
(
val
)
{
...
...
dbug/dbug.c
View file @
6a951239
...
...
@@ -501,7 +501,7 @@ void _db_push_ (const char *control)
if
(
!
_db_fp_
)
_db_fp_
=
stderr
;
/* Output stream, default stderr */
if
(
control
&&
*
control
==
'-'
)
if
(
*
control
==
'-'
)
{
if
(
*++
control
==
'#'
)
control
++
;
...
...
mysys/charset.c
View file @
6a951239
...
...
@@ -300,7 +300,25 @@ static CHARSET_INFO *find_charset_by_name(CHARSET_INFO **table,
return
NULL
;
}
static
CHARSET_INFO
*
add_charset
(
uint
cs_number
,
const
char
*
cs_name
,
myf
flags
)
/*
Read charset from file.
NOTES
One never has to deallocate character sets. They will all be deallocated
by my_once_free() when program ends.
If my_once_alloc() fails then this function may 'leak' some memory
which my_once_free() will deallocate, but this is so unlikely to happen
that this can be ignored.
RETURN
0 Error
# Pointer to allocated charset structure
*/
static
CHARSET_INFO
*
add_charset
(
uint
cs_number
,
const
char
*
cs_name
,
myf
flags
)
{
CHARSET_INFO
tmp_cs
,
*
cs
;
uchar
tmp_ctype
[
CTYPE_TABLE_SIZE
];
...
...
@@ -317,17 +335,23 @@ static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name, myf flags)
cs
->
sort_order
=
tmp_sort_order
;
cs
->
strxfrm_multiply
=
cs
->
mbmaxlen
=
1
;
if
(
read_charset_file
(
cs_number
,
cs
,
flags
))
return
NULL
;
return
0
;
cs
=
(
CHARSET_INFO
*
)
my_once_alloc
(
sizeof
(
CHARSET_INFO
),
MYF
(
MY_WME
));
*
cs
=
tmp_cs
;
cs
->
name
=
(
char
*
)
my_once_alloc
((
uint
)
strlen
(
cs_name
)
+
1
,
MYF
(
MY_WME
));
cs
->
ctype
=
(
uchar
*
)
my_once_alloc
(
CTYPE_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
to_lower
=
(
uchar
*
)
my_once_alloc
(
TO_LOWER_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
to_upper
=
(
uchar
*
)
my_once_alloc
(
TO_UPPER_TABLE_SIZE
,
MYF
(
MY_WME
));
if
(
!
(
cs
=
(
CHARSET_INFO
*
)
my_once_alloc
(
sizeof
(
CHARSET_INFO
),
MYF
(
MY_WME
))))
return
0
;
*
cs
=
tmp_cs
;
cs
->
name
=
(
char
*
)
my_once_alloc
((
uint
)
strlen
(
cs_name
)
+
1
,
MYF
(
MY_WME
));
cs
->
ctype
=
(
uchar
*
)
my_once_alloc
(
CTYPE_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
to_lower
=
(
uchar
*
)
my_once_alloc
(
TO_LOWER_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
to_upper
=
(
uchar
*
)
my_once_alloc
(
TO_UPPER_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
sort_order
=
(
uchar
*
)
my_once_alloc
(
SORT_ORDER_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
number
=
cs_number
;
if
(
!
cs
->
name
||
!
cs
->
ctype
||
!
cs
->
to_lower
||
!
cs
->
to_upper
||
!
cs
->
sort_order
)
return
0
;
cs
->
number
=
cs_number
;
memcpy
((
char
*
)
cs
->
name
,
(
char
*
)
cs_name
,
strlen
(
cs_name
)
+
1
);
memcpy
((
char
*
)
cs
->
ctype
,
(
char
*
)
tmp_ctype
,
sizeof
(
tmp_ctype
));
memcpy
((
char
*
)
cs
->
to_lower
,
(
char
*
)
tmp_to_lower
,
sizeof
(
tmp_to_lower
));
...
...
regex/reginit.c
View file @
6a951239
...
...
@@ -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
;
...
...
sql/item_strfunc.cc
View file @
6a951239
...
...
@@ -2043,6 +2043,10 @@ String* Item_func_export_set::val_str(String* str)
null_value
=
1
;
return
0
;
}
/*
Arg count can only be 3, 4 or 5 here. This is guaranteed from the
grammar for EXPORT_SET()
*/
switch
(
arg_count
)
{
case
5
:
num_set_values
=
(
uint
)
args
[
4
]
->
val_int
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment