Changeset: 9a59ff040bcf for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a59ff040bcf
Modified Files:
        monetdb5/mal/mal_profiler.c
        tools/merovingian/daemon/controlrunner.c
Branch: default
Log Message:

Merged from Jul2012


diffs (123 lines):

diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -437,8 +437,10 @@ setLogFile(stream *fd, Module mod, str f
 {
        (void)mod;      /* still unused */
        mal_set_lock(mal_profileLock, "profileLock");
-       if (eventstream )
+       if (eventstream ) {
+               mal_unset_lock(mal_profileLock, "profileLock");
                throw(IO, "mal.profiler", "Log file already set");
+       }
        if (strcmp(fname, "console") == 0)
                eventstream = mal_clients[0].fdout;
        else if (strcmp(fname, "stdout") == 0)
@@ -446,6 +448,7 @@ setLogFile(stream *fd, Module mod, str f
        else
                eventstream = open_wastream(fname);
        if (eventstream == NULL) {
+               mal_unset_lock(mal_profileLock, "profileLock");
                throw(IO, "mal.profiler", RUNTIME_STREAM_FAILED);
        }
        mal_unset_lock(mal_profileLock, "profileLock");
@@ -457,8 +460,10 @@ setLogStream(Module cntxt, str host, int
 {
        (void)cntxt;        /* still unused */
        mal_set_lock(mal_profileLock, "profileLock");
-       if ((eventstream = udp_wastream(host, port, "profileStream")) == NULL)
+       if ((eventstream = udp_wastream(host, port, "profileStream")) == NULL) {
+               mal_unset_lock(mal_profileLock, "profileLock");
                throw(IO, "mal.profiler", RUNTIME_STREAM_FAILED);
+       }
        eventstream = wbstream(eventstream, BUFSIZ);
        mal_unset_lock(mal_profileLock, "profileLock");
        return MAL_SUCCEED;
@@ -469,8 +474,10 @@ setLogStreamStream(Module cntxt, stream 
 {
        (void)cntxt;        /* still unused */
        mal_set_lock(mal_profileLock, "profileLock");
-       if ((eventstream = s) == NULL)
+       if ((eventstream = s) == NULL) {
+               mal_unset_lock(mal_profileLock, "profileLock");
                throw(ILLARG, "mal.profiler", "stream must not be NULL");
+       }
        eventstream = wbstream(eventstream, BUFSIZ);
        mal_unset_lock(mal_profileLock, "profileLock");
        return MAL_SUCCEED;
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -146,12 +146,14 @@ control_authorise(
        pwd = mcrypt_hashPassword(algo,
                        getConfVal(_mero_props, "passphrase"), chal);
        if (strcmp(pwd, passwd) != 0) {
+               free(pwd);
                Mfprintf(_mero_ctlout, "%s: permission denied "
                                "(bad passphrase)\n", host);
                mnstr_printf(fout, "!access denied\n");
                mnstr_flush(fout);
                return 0;
        }
+       free(pwd);
 
        mnstr_printf(fout, "=OK\n");
        mnstr_flush(fout);
@@ -422,6 +424,8 @@ static void ctl_handle_client(
                                                len = snprintf(buf2, 
sizeof(buf2), "OK\n");
                                                send_client("!");
                                        }
+                                       freeConfFile(props);
+                                       free(props);
                                }
                        } else if (strcmp(p, "destroy") == 0) {
                                err e = db_destroy(q);
@@ -520,7 +524,7 @@ static void ctl_handle_client(
                                        len = snprintf(buf2, sizeof(buf2), 
"OK\n");
                                        send_client("=");
                                }
-                       } else if (strchr(p, '=') != NULL) {
+                       } else if (strchr(p, '=') != NULL) { /* set */
                                char *val;
                                char doshare = 0;
 
@@ -644,10 +648,12 @@ static void ctl_handle_client(
                                        /* send defaults to client */
                                        writePropsBuf(_mero_db_props, &pbuf);
                                        send_list();
-                                       free(props);
 
                                        Mfprintf(_mero_ctlout, "%s: served 
default property "
                                                        "list\n", origin);
+                                       freeConfFile(props);
+                                       free(props);
+                                       free(pbuf);
                                        break;
                                }
 
@@ -658,6 +664,8 @@ static void ctl_handle_client(
                                        Mfprintf(_mero_ctlerr, "%s: get: 
msab_getStatus: "
                                                        "%s\n", origin, e);
                                        freeErr(e);
+                                       freeConfFile(props);
+                                       free(props);
                                        break;
                                }
                                if (stats == NULL) {
@@ -666,6 +674,8 @@ static void ctl_handle_client(
                                        len = snprintf(buf2, sizeof(buf2),
                                                        "unknown database: 
%s\n", q);
                                        send_client("!");
+                                       freeConfFile(props);
+                                       free(props);
                                        break;
                                }
 
@@ -676,6 +686,7 @@ static void ctl_handle_client(
                                send_list();
                                freeConfFile(props);
                                free(props);
+                               free(pbuf);
                                msab_freeStatus(&stats);
 
                                Mfprintf(_mero_ctlout, "%s: served property 
list for "
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to