Changeset: 3147db366a2d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3147db366a2d
Modified Files:
        monetdb5/mal/mal_profiler.c
Branch: Jul2012
Log Message:

Unlock before error return.


diffs (47 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
@@ -432,8 +432,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)
@@ -441,6 +443,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");
@@ -452,8 +455,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;
@@ -464,8 +469,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;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to