Changeset: 22afef703a68 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/22afef703a68
Modified Files:
        sql/backends/monet5/sql_user.c
Branch: triggers
Log Message:

fixed some more leaks


diffs (48 lines):

diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -390,13 +390,13 @@ monet5_password_hash(mvc *m, const char 
        oid rid = getUserOIDByName(m, username);
        str password = getUserPassword(m, rid);
        if (password) {
-               if ((msg = AUTHdecypherValue(&hash, password)) != MAL_SUCCEED) {
+               msg = AUTHdecypherValue(&hash, password);
+               GDKfree(password);
+               if (msg) {
                        (void) sql_error(m, 02, SQLSTATE(42000) 
"monet5_password_hash: %s", getExceptionMessage(msg));
                        freeException(msg);
-                       GDKfree(password);
                }
        }
-       GDKfree(password);
        return hash;
 }
 
@@ -912,8 +912,12 @@ remote_create(mvc *m, sqlid id, const st
        if (strNil(password)) {
                oid rid = getUserOIDByName(m, username);
                str cypher = getUserPassword(m, rid);
-               if (AUTHdecypherValue(&pwhash, cypher))
+               str err = AUTHdecypherValue(&pwhash, cypher);
+               GDKfree(cypher);
+               if (err) {
+                       GDKfree(err);
                        throw(MAL, "addRemoteTableCredentials", SQLSTATE(42000) 
"Crypt backend hash not found");
+               }
        }
        str msg = AUTHcypherValue(&cypher, pwhash);
        if (pwhash != password)
@@ -945,8 +949,11 @@ remote_get(mvc *m, sqlid id, str *userna
                *username = GDKstrdup("");
        }
        str hashpw = store->table_api.column_find_value(tr, 
find_sql_column(remote_user_info, "password"), rid);
-       if (AUTHdecypherValue(password, hashpw))
+       str err = AUTHdecypherValue(password, hashpw);
+       GDKfree(hashpw);
+       if (err) {
+               GDKfree(err); /* pass up, change api to return str */
                return -2;
-       GDKfree(hashpw);
+       }
        return 0;
 }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to