mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-35575 Fix memory leak, when installing auth_gssapi plugin fails.
Make sure to release memory, which was allocated by gss_import_name(). Also when plugin_init() fails.
This commit is contained in:
parent
a2f510fccf
commit
4e9c7031a5
1 changed files with 11 additions and 5 deletions
|
@ -85,6 +85,15 @@ cleanup:
|
|||
return default_name;
|
||||
}
|
||||
|
||||
static void release_service_name()
|
||||
{
|
||||
if (service_name != GSS_C_NO_NAME)
|
||||
{
|
||||
OM_uint32 minor;
|
||||
gss_release_name(&minor, &service_name);
|
||||
service_name= GSS_C_NO_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
int plugin_init()
|
||||
{
|
||||
|
@ -127,6 +136,7 @@ int plugin_init()
|
|||
if (GSS_ERROR(major))
|
||||
{
|
||||
log_error(major, minor, "gss_acquire_cred failed");
|
||||
release_service_name();
|
||||
return -1;
|
||||
}
|
||||
gss_release_cred(&minor, &cred);
|
||||
|
@ -136,11 +146,7 @@ int plugin_init()
|
|||
|
||||
int plugin_deinit()
|
||||
{
|
||||
if (service_name != GSS_C_NO_NAME)
|
||||
{
|
||||
OM_uint32 minor;
|
||||
gss_release_name(&minor, &service_name);
|
||||
}
|
||||
release_service_name();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue