fix: PR review feedback - double-free, end comments, dead code

- Fix double-free bug in free_account_details() (lib/MySQL_Authentication.cpp)
- Fix trailing #endif comments in 5 files to match guard names
- Rename __SIZE -> SIZE_ in LDAP_USER_FIELD_IDX enum
- Remove dead code: Query_Processor_Output ctor now calls init()
v3.0-lint
Rene Cannao 1 month ago
parent d5ffcba695
commit a82224f1ef

@ -334,4 +334,4 @@ public:
#endif /* PROXYSQLGENAI */
#endif // __CLASS_LLM_BRIDGE_H
#endif /* PROXYSQL_LLM_BRIDGE_H */

@ -2,11 +2,11 @@
#define CLASS_MYSQL_LDAP_AUTHENTICATION_H
struct LDAP_USER_FIELD_IDX {
enum index {
enum index : uint8_t {
USERNAME = 0,
FRONTEND_CONNECTIONS = 1,
FRONTED_MAX_CONNECTIONS = 2,
__SIZE
SIZE_
};
};

@ -24,4 +24,4 @@ void proxy_coredump_generate();
}\
}
#endif // __PROXYSQL_COREDUMP_H
#endif /* PROXYSQL_COREDUMP_H */

@ -40,4 +40,4 @@ public:
void save_restapi_runtime_to_database(bool);
};
#endif // #ifndef __PROXYSQL_RESTAPI_H__
#endif /* PROXYSQL_RESTAPI_H */

@ -118,4 +118,4 @@ void proxysql_keylog_write_line_callback(const SSL* ssl, const char* line);
*/
void proxysql_keylog_set_pgsql_callback();
#endif // __PROXYSQL_SSLKEYLOG_H
#endif /* PROXYSQL_SSLKEYLOG_H */

@ -184,15 +184,8 @@ class Query_Processor_Output {
void operator delete(void *ptr) {
l_free(sizeof(Query_Processor_Output),ptr);
}
Query_Processor_Output()
: ptr(nullptr), size(0), destination_hostgroup(-1), mirror_hostgroup(-1),
mirror_flagOUT(false), next_query_flagIN(false), cache_ttl(0),
cache_empty_result(false), cache_timeout(0), reconnect(true),
timeout(0), retries(3), delay(0), error_msg(nullptr), OK_msg(nullptr),
sticky_conn(false), multiplex(true), max_lag_ms(0), log(false),
firewall_whitelist_mode(false), attributes(nullptr), comment(nullptr),
create_new_conn(false), new_query(nullptr)
{
Query_Processor_Output() {
init();
}
~Query_Processor_Output() {
//destroy();

@ -23,10 +23,6 @@ void free_account_details(account_details_t& ad) {
free(ad.sha1_pass);
ad.sha1_pass=NULL;
}
if (ad.password) {
free(ad.password);
ad.password = nullptr;
}
if (ad.clear_text_password[PASSWORD_TYPE::PRIMARY]) {
free(ad.clear_text_password[PASSWORD_TYPE::PRIMARY]);
ad.clear_text_password[PASSWORD_TYPE::PRIMARY] = nullptr;

Loading…
Cancel
Save