4700 Tor Didriksen 2012-11-30
Bug#15934078 MEMORY LEAK IN INIT_RSA_KEYS
Always close priv_key_file and public_key_file before returning
from init_rsa_keys()
modified:
sql/sql_acl.cc
4699 Vasil Dimov 2012-11-30
Followup to vasil.dimov@stripped:
fix a bogus compiler warning about using table_name_bufend uninitialized.
modified:
storage/innobase/handler/i_s.cc
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2012-11-29 11:55:35 +0000
+++ b/sql/sql_acl.cc 2012-11-30 10:26:09 +0000
@@ -11245,6 +11245,18 @@ void deinit_rsa_keys(void)
g_rsa_keys.free_memory();
}
+// Wraps a FILE handle, to ensure we always close it when returning.
+class FileCloser
+{
+ FILE *m_file;
+public:
+ FileCloser(FILE *to_be_closed) : m_file(to_be_closed) {}
+ ~FileCloser()
+ {
+ if (m_file != NULL)
+ fclose(m_file);
+ }
+};
/**
Loads the RSA key pair from disk and store them in a global variable.
@@ -11299,6 +11311,7 @@ int init_rsa_keys(void)
/* Don't return an error; server will still be able to operate. */
return 0;
}
+ FileCloser close_priv(priv_key_file);
if (strchr(auth_rsa_public_key_path, FN_LIBCHAR) != NULL ||
strchr(auth_rsa_public_key_path, FN_LIBCHAR2) != NULL)
@@ -11321,6 +11334,7 @@ int init_rsa_keys(void)
/* Don't return an error; server will still be able to operate. */
return 0;
}
+ FileCloser close_public(public_key_file);
RSA *rsa_private_key= RSA_new();
if (g_rsa_keys.set_private_key(PEM_read_RSAPrivateKey(priv_key_file,
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.6 branch (tor.didriksen:4699 to 4700) Bug#15934078 | Tor Didriksen | 30 Nov |