Changeset: 02cd32d51e55 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/02cd32d51e55
Modified Files:
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_embedded.c
        testing/Mtest.py.in
        tools/mserver/mserver5.c
        tools/mserver/shutdowntest.c
Branch: Sep2022
Log Message:

A little cleanup.


diffs (103 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
@@ -50,8 +50,7 @@ static AUTHCallbackCntx authCallbackCntx
 
 void AUTHreset(void)
 {
-       if (vaultKey != NULL)
-               GDKfree(vaultKey);
+       GDKfree(vaultKey);
        vaultKey = NULL;
 }
 
@@ -414,8 +413,7 @@ AUTHunlockVault(const char *password)
        /* even though I think this function should be called only once, it
         * is not of real extra efforts to avoid a mem-leak if it is used
         * multiple times */
-       if (vaultKey != NULL)
-               GDKfree(vaultKey);
+       GDKfree(vaultKey);
 
        if ((vaultKey = GDKstrdup(password)) == NULL)
                throw(MAL, "unlockVault", SQLSTATE(HY013) MAL_MALLOC_FAIL " 
vault key");
@@ -502,7 +500,7 @@ AUTHcypherValue(str *ret, const char *va
        keylen = strlen(vaultKey);
 
        /* XOR all characters.  If we encounter a 'zero' char after the XOR
-        * operation, escape it with an 'one' char. */
+        * operation, escape it with a 'one' char. */
        for (; *s != '\0'; s++) {
                *w = *s ^ vaultKey[(s - value) % keylen];
                if (*w == '\0') {
diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c
--- a/monetdb5/mal/mal_embedded.c
+++ b/monetdb5/mal/mal_embedded.c
@@ -53,7 +53,6 @@ malEmbeddedBoot(int workerlimit, int mem
                /* unlock the vault, first see if we can find the file which
                 * holds the secret */
                char secret[1024];
-               char *secretp = secret;
                FILE *secretf;
                size_t len;
 
@@ -78,7 +77,7 @@ malEmbeddedBoot(int workerlimit, int mem
                                        "(%zu), enlarge your vault key!\n", 
len);
                        }
                }
-               if ((msg = AUTHunlockVault(secretp)) != MAL_SUCCEED) {
+               if ((msg = AUTHunlockVault(secret)) != MAL_SUCCEED) {
                        /* don't show this as a crash */
                        return msg;
                }
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1387,7 +1387,7 @@ def PerformDir(env, testdir, testlist, t
                                         openutf8(os.path.join(TSTTRGDIR, 
'SingleServer.err'), 'a'),
                                         0,
                                         pollfile,
-                                        inmem)
+                                        inmem=inmem)
                     os.chdir(TSTTRGDIR)
                     pSrvr.LaunchIt()
                     if pSrvr.port is None:
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -740,7 +740,6 @@ main(int argc, char **av)
        {
                /* unlock the vault, first see if we can find the file which
                 * holds the secret */
-               char *secretp = secret;
                FILE *secretf;
                size_t len;
 
@@ -779,6 +778,7 @@ main(int argc, char **av)
                        exit(1);
                }
                if (readpwdxit) {
+                       char *secretp;
                        if (fgets(secret, (int) sizeof(secret), stdin) == NULL) 
{
                                fprintf(stderr, "!ERROR: no password read\n");
                                exit(1);
diff --git a/tools/mserver/shutdowntest.c b/tools/mserver/shutdowntest.c
--- a/tools/mserver/shutdowntest.c
+++ b/tools/mserver/shutdowntest.c
@@ -201,7 +201,6 @@ static str monetdb_initialize(void) {
                /* unlock the vault, first see if we can find the file which
                 * holds the secret */
                char secret[1024];
-               char *secretp = secret;
                FILE *secretf;
                size_t len;
 
@@ -235,7 +234,7 @@ static str monetdb_initialize(void) {
                        }
                        fclose(secretf);
                }
-               if ((retval = AUTHunlockVault(secretp)) != MAL_SUCCEED) {
+               if ((retval = AUTHunlockVault(secret)) != MAL_SUCCEED) {
                        /* don't show this as a crash */
                        err = msab_registerStop();
                        if (err)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to