Changeset: 3b079497d213 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3b079497d213
Modified Files:
        monetdb5/mal/mal_authorize.c
Branch: default
Log Message:

Coverity fix
Free the pwhash upon error


diffs (32 lines):

diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c
--- a/monetdb5/mal/mal_authorize.c
+++ b/monetdb5/mal/mal_authorize.c
@@ -1033,6 +1033,7 @@ AUTHaddRemoteTableCredentials(const char
        bool free_pw = false;
        str tmp, output = MAL_SUCCEED;
        BUN p;
+       str msg = MAL_SUCCEED;
 
        if (uri == NULL || strNil(uri))
                throw(ILLARG, "addRemoteTableCredentials", "URI cannot be nil");
@@ -1112,10 +1113,18 @@ AUTHaddRemoteTableCredentials(const char
                                throw(MAL, "addRemoteTableCredentials", 
SQLSTATE(42000) "Crypt backend hash not found");
                }
        }
-       rethrow("addRemoteTableCredentials", tmp, AUTHverifyPassword(pwhash));
+       msg = AUTHverifyPassword(pwhash);
+       if( msg != MAL_SUCCEED){
+               free(pwhash);
+               rethrow("addRemoteTableCredentials", tmp, msg);
+       }
 
        str cypher;
-       rethrow("addRemoteTableCredentials", tmp, AUTHcypherValue(&cypher, 
pwhash));
+       msg = AUTHcypherValue(&cypher, pwhash);
+       if( msg != MAL_SUCCEED){
+               free(pwhash);
+               rethrow("addRemoteTableCredentials", tmp, msg);
+       }
 
        /* Add entry */
        bool table_entry = (BUNappend(rt_key, local_table, true) == GDK_SUCCEED 
&&
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to