From 0a0c99ce7afb461c161cc4e0d2276a4e714e6091 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 15 Jan 2021 14:43:31 -0500 Subject: [PATCH] fix double free of mysql result --- src/zm_user.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/zm_user.cpp b/src/zm_user.cpp index 9a20aefaa..88284483e 100644 --- a/src/zm_user.cpp +++ b/src/zm_user.cpp @@ -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;