summaryrefslogtreecommitdiff
path: root/sql/sql_udf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r--sql/sql_udf.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 8791f547ea6..cd85b3dbaf2 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -285,12 +285,14 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
/* TODO: This should be changed to reader locks someday! */
pthread_mutex_lock(&THR_LOCK_udf);
- udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
- length ? length : (uint) strlen(name));
- if (!udf->dlhandle)
- udf=0; // Could not be opened
- else if (mark_used)
- udf->usage_count++;
+ if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
+ length ? length : (uint) strlen(name))))
+ {
+ if (!udf->dlhandle)
+ udf=0; // Could not be opened
+ else if (mark_used)
+ udf->usage_count++;
+ }
pthread_mutex_unlock(&THR_LOCK_udf);
DBUG_RETURN(udf);
}