Changeset: a5d42e6c6da0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a5d42e6c6da0
Modified Files:
        monetdb5/modules/mal/remote.mx
Branch: default
Log Message:

remote.get: make sure we unlock if we encounter an error


diffs (36 lines):

diff --git a/monetdb5/modules/mal/remote.mx b/monetdb5/modules/mal/remote.mx
--- a/monetdb5/modules/mal/remote.mx
+++ b/monetdb5/modules/mal/remote.mx
@@ -716,7 +716,6 @@
                stream *sin;
                char buf[256];
                ssize_t sz = 0, rd;
-               str err;
                BAT *b = NULL;
 
                /* this call should be a single transaction over the channel*/
@@ -735,14 +734,20 @@
                while ((rd = mnstr_read(sin, &buf[sz], 1, 1)) == 1 && buf[sz] 
!= '\n') {
                        sz += rd;
                }
-               if (rd < 0)
+               if (rd < 0) {
+                       mal_unset_lock(c->lock, "remote.get"); 
                        throw(MAL, "remote.get", "could not read BAT JSON 
header");
-               if (buf[0] == '!')
+               }
+               if (buf[0] == '!') {
+                       mal_unset_lock(c->lock, "remote.get"); 
                        return(GDKstrdup(buf));
+               }
 
                buf[sz] = '\0';
-               if ((err = RMTinternalcopyfrom(&b, buf, sin)) != NULL)
-                       return(err);
+               if ((tmp = RMTinternalcopyfrom(&b, buf, sin)) != NULL) {
+                       mal_unset_lock(c->lock, "remote.get"); 
+                       return(tmp);
+               }
 
                v->val.bval = b->batCacheid;
                v->vtype = TYPE_bat;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to