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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e30a3048
Commit
e30a3048
authored
Feb 07, 2021
by
Monty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that mysqlbinlog frees all memory at exit
parent
4f4a4cf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+23
-14
No files found.
client/mysqlbinlog.cc
View file @
e30a3048
...
@@ -95,6 +95,7 @@ static uint opt_protocol= 0;
...
@@ -95,6 +95,7 @@ static uint opt_protocol= 0;
static
FILE
*
result_file
;
static
FILE
*
result_file
;
static
char
*
result_file_name
=
0
;
static
char
*
result_file_name
=
0
;
static
const
char
*
output_prefix
=
""
;
static
const
char
*
output_prefix
=
""
;
static
char
**
defaults_argv
=
0
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
static
const
char
*
default_dbug_option
=
"d:t:o,/tmp/mariadb-binlog.trace"
;
static
const
char
*
default_dbug_option
=
"d:t:o,/tmp/mariadb-binlog.trace"
;
...
@@ -1893,13 +1894,26 @@ static void cleanup()
...
@@ -1893,13 +1894,26 @@ static void cleanup()
delete
glob_description_event
;
delete
glob_description_event
;
if
(
mysql
)
if
(
mysql
)
mysql_close
(
mysql
);
mysql_close
(
mysql
);
free_defaults
(
defaults_argv
);
free_annotate_event
();
my_free_open_file_info
();
load_processor
.
destroy
();
mysql_server_end
();
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
static
void
die
()
{
cleanup
();
my_end
(
MY_DONT_FREE_DBUG
);
exit
(
1
);
}
static
void
print_version
()
static
void
print_version
()
{
{
printf
(
"%s Ver 3.
4
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
printf
(
"%s Ver 3.
5
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
}
}
...
@@ -1930,7 +1944,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
...
@@ -1930,7 +1944,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
l_time
.
time_type
!=
MYSQL_TIMESTAMP_DATETIME
||
status
.
warnings
)
l_time
.
time_type
!=
MYSQL_TIMESTAMP_DATETIME
||
status
.
warnings
)
{
{
error
(
"Incorrect date and time argument: %s"
,
str
);
error
(
"Incorrect date and time argument: %s"
,
str
);
exit
(
1
);
die
(
);
}
}
/*
/*
Note that Feb 30th, Apr 31st cause no error messages and are mapped to
Note that Feb 30th, Apr 31st cause no error messages and are mapped to
...
@@ -1988,7 +2002,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
...
@@ -1988,7 +2002,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
opt
->
name
))
<=
0
)
opt
->
name
))
<=
0
)
{
{
sf_leaking_memory
=
1
;
/* no memory leak reports here */
sf_leaking_memory
=
1
;
/* no memory leak reports here */
exit
(
1
);
die
(
);
}
}
break
;
break
;
#ifdef WHEN_FLASHBACK_REVIEW_READY
#ifdef WHEN_FLASHBACK_REVIEW_READY
...
@@ -2013,7 +2027,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
...
@@ -2013,7 +2027,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
opt
->
name
))
<=
0
)
opt
->
name
))
<=
0
)
{
{
sf_leaking_memory
=
1
;
/* no memory leak reports here */
sf_leaking_memory
=
1
;
/* no memory leak reports here */
exit
(
1
);
die
(
);
}
}
opt_base64_output_mode
=
(
enum_base64_output_mode
)
(
val
-
1
);
opt_base64_output_mode
=
(
enum_base64_output_mode
)
(
val
-
1
);
}
}
...
@@ -2098,7 +2112,9 @@ static int parse_args(int *argc, char*** argv)
...
@@ -2098,7 +2112,9 @@ static int parse_args(int *argc, char*** argv)
int
ho_error
;
int
ho_error
;
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_options
,
get_one_option
)))
if
((
ho_error
=
handle_options
(
argc
,
argv
,
my_options
,
get_one_option
)))
exit
(
ho_error
);
{
die
();
}
if
(
debug_info_flag
)
if
(
debug_info_flag
)
my_end_arg
=
MY_CHECK_ERROR
|
MY_GIVE_INFO
;
my_end_arg
=
MY_CHECK_ERROR
|
MY_GIVE_INFO
;
else
if
(
debug_check_flag
)
else
if
(
debug_check_flag
)
...
@@ -3017,7 +3033,6 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
...
@@ -3017,7 +3033,6 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
char
**
defaults_argv
;
Exit_status
retval
=
OK_CONTINUE
;
Exit_status
retval
=
OK_CONTINUE
;
ulonglong
save_stop_position
;
ulonglong
save_stop_position
;
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
...
@@ -3068,7 +3083,7 @@ int main(int argc, char** argv)
...
@@ -3068,7 +3083,7 @@ int main(int argc, char** argv)
if
(
!
remote_opt
)
if
(
!
remote_opt
)
{
{
error
(
"The --raw mode only works with --read-from-remote-server"
);
error
(
"The --raw mode only works with --read-from-remote-server"
);
exit
(
1
);
die
(
);
}
}
if
(
one_database
)
if
(
one_database
)
warning
(
"The --database option is ignored in raw mode"
);
warning
(
"The --database option is ignored in raw mode"
);
...
@@ -3090,7 +3105,7 @@ int main(int argc, char** argv)
...
@@ -3090,7 +3105,7 @@ int main(int argc, char** argv)
O_WRONLY
|
O_BINARY
,
MYF
(
MY_WME
))))
O_WRONLY
|
O_BINARY
,
MYF
(
MY_WME
))))
{
{
error
(
"Could not create log file '%s'"
,
result_file_name
);
error
(
"Could not create log file '%s'"
,
result_file_name
);
exit
(
1
);
die
(
);
}
}
}
}
else
else
...
@@ -3211,11 +3226,6 @@ int main(int argc, char** argv)
...
@@ -3211,11 +3226,6 @@ int main(int argc, char** argv)
if
(
result_file
&&
result_file
!=
stdout
)
if
(
result_file
&&
result_file
!=
stdout
)
my_fclose
(
result_file
,
MYF
(
0
));
my_fclose
(
result_file
,
MYF
(
0
));
cleanup
();
cleanup
();
free_annotate_event
();
free_defaults
(
defaults_argv
);
my_free_open_file_info
();
load_processor
.
destroy
();
mysql_server_end
();
/* We cannot free DBUG, it is used in global destructors after exit(). */
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end
(
my_end_arg
|
MY_DONT_FREE_DBUG
);
my_end
(
my_end_arg
|
MY_DONT_FREE_DBUG
);
...
@@ -3225,7 +3235,6 @@ int main(int argc, char** argv)
...
@@ -3225,7 +3235,6 @@ int main(int argc, char** argv)
err:
err:
cleanup
();
cleanup
();
free_defaults
(
defaults_argv
);
my_end
(
my_end_arg
);
my_end
(
my_end_arg
);
exit
(
retval
==
ERROR_STOP
?
1
:
0
);
exit
(
retval
==
ERROR_STOP
?
1
:
0
);
DBUG_RETURN
(
retval
==
ERROR_STOP
?
1
:
0
);
DBUG_RETURN
(
retval
==
ERROR_STOP
?
1
:
0
);
...
...
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