summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2022-09-13 11:46:28 +0900
committerNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-09-21 15:04:33 +0900
commitca51c9fd596268900e466e26e5d3c2a3c6db9cb3 (patch)
treecee6473f0d67dd1236032023dea769850b552191 /sql
parent789f55c947a8aa224e5b0a71d5c0bea375320091 (diff)
downloadmariadb-git-ca51c9fd596268900e466e26e5d3c2a3c6db9cb3.tar.gz
MDEV-29352 SIGSEGV's in strlen and unknown location on optimized builds at SHUTDOWN
When the UDF creation frails to write the newly created UDF into the related system table, the UDF is still created in memory. However, as it is now, the related DLL is unloaded in this case right in the mysql_create_function. And failure happens when the UDF handle is freed and tries to unload the respective DLL which is still unloaded.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_udf.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index b55bbc7ffac..02f068e9bbc 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -620,7 +620,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
/* Allow creation of functions even if we can't open func table */
if (unlikely(!table))
- goto err;
+ goto err_open_func_table;
table->use_all_columns();
restore_record(table, s->default_values); // Default values for fields
table->field[0]->store(u_d->name.str, u_d->name.length, system_charset_info);
@@ -634,7 +634,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
{
my_error(ER_ERROR_ON_WRITE, MYF(0), "mysql.func", error);
del_udf(u_d);
- goto err;
+ goto err_open_func_table;
}
done:
@@ -649,6 +649,7 @@ done:
err:
if (new_dl)
dlclose(dl);
+err_open_func_table:
mysql_rwlock_unlock(&THR_LOCK_udf);
DBUG_RETURN(1);
}