mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03: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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user