Changeset: e2dbfb928a9c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e2dbfb928a9c
Modified Files:
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_builder.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_profiler.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/remote.c
Branch: default
Log Message:

Merge with Jan2014 branch.


diffs (245 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
@@ -418,7 +418,6 @@ AUTHchangePassword(Client *c, str *oldpa
        /* decypher the password */
        msg= AUTHdecypherValue(&hash, &tmp);
        if ( msg){
-               GDKfree(hash);
                return msg;
        }
        if (strcmp(hash, *oldpass) != 0){
@@ -430,7 +429,6 @@ AUTHchangePassword(Client *c, str *oldpa
        /* cypher the password */
        msg= AUTHcypherValue(&hash, passwd);
        if ( msg){
-               GDKfree(hash);
                return msg;
        }
 
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -433,6 +433,7 @@ pushNilType(MalBlkPtr mb, InstrPtr q, ch
 {
        int _t,idx;
        ValRecord cst;
+       str msg;
 
        if (q == NULL)
                return NULL;
@@ -442,7 +443,11 @@ pushNilType(MalBlkPtr mb, InstrPtr q, ch
        cst.vtype=TYPE_void;
        cst.val.oval= oid_nil;
        cst.len = 0;
-       convertConstant(idx, &cst);
+       msg = convertConstant(idx, &cst);
+       if (msg != MAL_SUCCEED) {
+               GDKfree(msg);
+               return NULL;
+       }
        _t = defConstant(mb,idx,&cst);
        setVarUDFtype(mb,_t);
 
@@ -453,13 +458,18 @@ pushType(MalBlkPtr mb, InstrPtr q, int t
 {
        int _t;
        ValRecord cst;
+       str msg;
 
        if (q == NULL)
                return NULL;
        cst.vtype=TYPE_void;
        cst.val.oval= oid_nil;
        cst.len = 0;
-       convertConstant(tpe, &cst);
+       msg = convertConstant(tpe, &cst);
+       if (msg != MAL_SUCCEED) {
+               GDKfree(msg);
+               return NULL;
+       }
        _t = defConstant(mb,tpe,&cst);
        setVarUDFtype(mb,_t);
 
@@ -471,13 +481,18 @@ pushZero(MalBlkPtr mb, InstrPtr q, int t
 {
        int _t;
        ValRecord cst;
+       str msg;
 
        if (q == NULL)
                return NULL;
        cst.vtype=TYPE_int;
        cst.val.ival= 0;
        cst.len = 0;
-       convertConstant(tpe, &cst);
+       msg = convertConstant(tpe, &cst);
+       if (msg != MAL_SUCCEED) {
+               GDKfree(msg);
+               return NULL;
+       }
        _t = defConstant(mb,tpe,&cst);
 
        return pushArgument(mb, q, _t);
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -993,9 +993,10 @@ showFlowGraph(MalBlkPtr mb, MalStkPtr st
                }
                free(buf);
        } else if (f != GDKout) {
-               if (stethoscope ) 
+               if (!stethoscope ) {
+                       MT_sleep_ms(4000); /* delay for stethoscope */
                        mnstr_close(f);
-               else MT_sleep_ms(4000); /* delay for stethoscope */
+               }
        }
 }
 
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
@@ -1316,8 +1316,7 @@ static int getCPULoad(char cpuload[BUFSI
                        s= strchr(s,' ');
                        if (s == NULL)          /* unexpected format of file */
                                break;
-                       if ( cpu < 0 || cpu > 255) goto skip;
-                       
+
                        while( *s && isspace((int)*s)) s++;
                        i= sscanf(s,LLFMT" "LLFMT" "LLFMT" "LLFMT" "LLFMT,  
&user, &nice, &system, &idle, &iowait);
                        if ( i != 5 )
diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -267,7 +267,7 @@ ALGminany(ptr result, int *bid)
        ptr p;
        str msg = MAL_SUCCEED;
 
-       if ((b = BATdescriptor(*bid)) == NULL)
+       if (result == NULL || (b = BATdescriptor(*bid)) == NULL)
                throw(MAL, "algebra.min", RUNTIME_OBJECT_MISSING);
 
        if (!ATOMlinear(b->ttype)) {
@@ -279,6 +279,7 @@ ALGminany(ptr result, int *bid)
                        * (ptr *) result = p = BATmin(b, NULL);
                } else {
                        p = BATmin(b, result);
+                       assert(p == result);
                }
                if (p == NULL)
                        msg = createException(MAL, "algebra.min", 
GDK_EXCEPTION);
@@ -294,7 +295,7 @@ ALGmaxany(ptr result, int *bid)
        ptr p;
        str msg = MAL_SUCCEED;
 
-       if ((b = BATdescriptor(*bid)) == NULL)
+       if (result == NULL || (b = BATdescriptor(*bid)) == NULL)
                throw(MAL, "algebra.max", RUNTIME_OBJECT_MISSING);
 
        if (!ATOMlinear(b->ttype)) {
@@ -306,6 +307,7 @@ ALGmaxany(ptr result, int *bid)
                        * (ptr *) result = p = BATmax(b, NULL);
                } else {
                        p = BATmax(b, result);
+                       assert(p == result);
                }
                if (p == NULL)
                        msg = createException(MAL, "algebra.max", 
GDK_EXCEPTION);
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -457,10 +457,12 @@ SERVERlisten(int *Port, str *Usockfile, 
                }
 
                if( setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &on, 
sizeof on) ) {
+                       char *err = strerror(errno);
                        GDKfree(psock);
                        if (usockfile)
                                GDKfree(usockfile);
-                       throw(IO, "mal_mapi.listen", OPERATION_FAILED ": 
setsockptr failed %s", strerror(errno));
+                       closesocket(sock);
+                       throw(IO, "mal_mapi.listen", OPERATION_FAILED ": 
setsockptr failed %s", err);
                }
 
                server.sin_family = AF_INET;
@@ -569,6 +571,8 @@ SERVERlisten(int *Port, str *Usockfile, 
        psock[2] = INVALID_SOCKET;
        if (MT_create_thread(pidp, (void (*)(void *)) SERVERlistenThread, 
psock, MT_THR_DETACHED) != 0) {
                GDKfree(psock);
+               if (usockfile)
+                       GDKfree(usockfile);
                throw(MAL, "mal_mapi.listen", OPERATION_FAILED ": starting 
thread failed");
        }
 #ifdef DEBUG_SERVER
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -1641,6 +1641,7 @@ PCRElike_pcre(int *ret, int *b, str *pat
                                        r = PCREuselect(ret, &ppat, b, &ignore);
                                else
                                        r = PCREselect(ret, &ppat, b, &ignore);
+                               GDKfree(ppat);
                        } else {
                                BAT *bp = BATdescriptor(*b);
                                BAT *res = NULL;
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -178,9 +178,13 @@ str RMTconnectScen(
                                "is not supported", *scen);
 
        m = mapi_mapiuri(*ouri, *user, *passwd, *scen);
-       if (mapi_error(m))
-               throw(MAL, "remote.connect", "unable to connect to '%s': %s",
-                               *ouri, mapi_error_str(m));
+       if (mapi_error(m)) {
+               msg = createException(MAL, "remote.connect",
+                                                         "unable to connect to 
'%s': %s",
+                                                         *ouri, 
mapi_error_str(m));
+               mapi_destroy(m);
+               return msg;
+       }
 
        MT_lock_set(&mal_remoteLock, "remote.connect");
 
@@ -196,10 +200,12 @@ str RMTconnectScen(
        }
 
        if (mapi_reconnect(m) != MOK) {
+               MT_lock_unset(&mal_remoteLock, "remote.connect");
+               msg = createException(IO, "remote.connect",
+                                                         "unable to connect to 
'%s': %s",
+                                                         *ouri, 
mapi_error_str(m));
                mapi_destroy(m);
-               MT_lock_unset(&mal_remoteLock, "remote.connect");
-               throw(IO, "remote.connect", "unable to connect to '%s': %s",
-                               *ouri, mapi_error_str(m));
+               return msg;
        }
 
        /* connection established, add to list */
@@ -747,17 +753,20 @@ str RMTput(Client cntxt, MalBlkPtr mb, M
                mapi_close_handle(mhdl);
        } else {
                str val = NULL;
+               char *tpe;
                char qbuf[BUFSIZ + 1]; /* FIXME: this should be dynamic */
                if (ATOMvarsized(type)) {
                        ATOMformat(type, *(str *)value, &val);
                } else {
                        ATOMformat(type, value, &val);
                }
+               tpe = getTypeIdentifier(type);
                if (type <= TYPE_str)
-                       snprintf(qbuf, BUFSIZ, "%s := %s:%s;\n", ident, val, 
getTypeIdentifier(type));
+                       snprintf(qbuf, BUFSIZ, "%s := %s:%s;\n", ident, val, 
tpe);
                else
-                       snprintf(qbuf, BUFSIZ, "%s := \"%s\":%s;\n", ident, 
val, getTypeIdentifier(type));
+                       snprintf(qbuf, BUFSIZ, "%s := \"%s\":%s;\n", ident, 
val, tpe);
                qbuf[BUFSIZ] = '\0';
+               GDKfree(tpe);
                GDKfree(val);
 #ifdef _DEBUG_REMOTE
                mnstr_printf(cntxt->fdout, "#remote.put:%s:%s\n", c->name, 
qbuf);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to