Skip to content

Commit

Permalink
Adjust Mariadb init and deinit (#1133)
Browse files Browse the repository at this point in the history
Closes #1123
  • Loading branch information
Mr-DaveDev authored Apr 13, 2020
1 parent 278fb1e commit c73d60a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,10 +1039,7 @@ static int dbse_init_mysql(struct context *cnt){
#if defined(HAVE_MYSQL) || defined(HAVE_MARIADB)
int dbport;
if ((!strcmp(cnt->conf.database_type, "mysql")) && (cnt->conf.database_dbname)) {
// close database to be sure that we are not leaking
mysql_close(cnt->database);
cnt->database_event_id = 0;

cnt->database = mymalloc(sizeof(MYSQL));
mysql_init(cnt->database);
if ((cnt->conf.database_port < 0) || (cnt->conf.database_port > 65535)){
Expand Down Expand Up @@ -1167,6 +1164,7 @@ static void dbse_deinit(struct context *cnt){
if (cnt->conf.database_type) {
#if defined(HAVE_MYSQL) || defined(HAVE_MARIADB)
if ( (!strcmp(cnt->conf.database_type, "mysql")) && (cnt->conf.database_dbname)) {
mysql_thread_end();
mysql_close(cnt->database);
cnt->database_event_id = 0;
}
Expand Down

0 comments on commit c73d60a

Please sign in to comment.