|
1 | | -/* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. |
| 1 | +/* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify |
4 | 4 | it under the terms of the GNU General Public License, version 2.0, |
@@ -1024,15 +1024,23 @@ static bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg) { |
1024 | 1024 | return false; |
1025 | 1025 | } |
1026 | 1026 |
|
1027 | | - /* Copy subscription mask from the plugin into the array. */ |
1028 | | - add_audit_mask(evt->subscribed_mask, data->class_mask); |
1029 | | - |
1030 | 1027 | /* Prevent from adding the same plugin more than one time. */ |
1031 | | - if (thd->audit_class_plugins.exists(plugin)) return false; |
| 1028 | + if (!thd->audit_class_plugins.exists(plugin)) { |
| 1029 | + /* lock the plugin and add it to the list */ |
| 1030 | + plugin = my_plugin_lock(NULL, &plugin); |
| 1031 | + |
| 1032 | + /* The plugin could not be acquired. */ |
| 1033 | + if (plugin == NULL) { |
| 1034 | + /* Add this plugin mask to non subscribed mask. */ |
| 1035 | + add_audit_mask(evt->not_subscribed_mask, data->class_mask); |
| 1036 | + return false; |
| 1037 | + } |
1032 | 1038 |
|
1033 | | - /* lock the plugin and add it to the list */ |
1034 | | - plugin = my_plugin_lock(NULL, &plugin); |
1035 | | - thd->audit_class_plugins.push_back(plugin); |
| 1039 | + thd->audit_class_plugins.push_back(plugin); |
| 1040 | + } |
| 1041 | + |
| 1042 | + /* Copy subscription mask from the plugin into the array. */ |
| 1043 | + add_audit_mask(evt->subscribed_mask, data->class_mask); |
1036 | 1044 |
|
1037 | 1045 | return false; |
1038 | 1046 | } |
|
0 commit comments