mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +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;
|
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()
|
int plugin_init()
|
||||||
{
|
{
|
||||||
|
@ -127,6 +136,7 @@ int plugin_init()
|
||||||
if (GSS_ERROR(major))
|
if (GSS_ERROR(major))
|
||||||
{
|
{
|
||||||
log_error(major, minor, "gss_acquire_cred failed");
|
log_error(major, minor, "gss_acquire_cred failed");
|
||||||
|
release_service_name();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gss_release_cred(&minor, &cred);
|
gss_release_cred(&minor, &cred);
|
||||||
|
@ -136,11 +146,7 @@ int plugin_init()
|
||||||
|
|
||||||
int plugin_deinit()
|
int plugin_deinit()
|
||||||
{
|
{
|
||||||
if (service_name != GSS_C_NO_NAME)
|
release_service_name();
|
||||||
{
|
|
||||||
OM_uint32 minor;
|
|
||||||
gss_release_name(&minor, &service_name);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue