fix double free of mysql result

pull/3122/head
Isaac Connor 2021-01-15 14:43:31 -05:00
parent 23305be8bf
commit 0a0c99ce7a
1 changed files with 3 additions and 1 deletions

View File

@ -133,6 +133,7 @@ User *zmLoadUser(const char *username, const char *password) {
MYSQL_ROW dbrow = mysql_fetch_row(result);
User *user = new User(dbrow);
mysql_free_result(result);
result = nullptr;
if (
(! password ) // relay type must be none
@ -142,7 +143,8 @@ User *zmLoadUser(const char *username, const char *password) {
return user;
}
} // end if 1 result from db
mysql_free_result(result);
if ( result )
mysql_free_result(result);
Warning("Unable to authenticate user %s", username);
return nullptr;