Changeset: 69c07b025b23 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=69c07b025b23 Modified Files: common/stream/stream.c monetdb5/mal/mal_client.c monetdb5/mal/mal_function.c monetdb5/mal/mal_import.c monetdb5/mal/mal_session.c monetdb5/optimizer/opt_pipes.c monetdb5/optimizer/opt_remap.c Branch: default Log Message:
Merge with Jul2017 diffs (134 lines): diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -2274,7 +2274,11 @@ socket_read(stream *s, void *buf, size_t } if (n == 0) /* unexpected end of file */ break; - nr += n; + nr += +#ifdef _MSC_VER + (int) +#endif + n; } } return nr / (ssize_t) elmsize; diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c --- a/monetdb5/mal/mal_client.c +++ b/monetdb5/mal/mal_client.c @@ -208,6 +208,10 @@ MCinitClientRecord(Client c, oid user, b c->blkmode = 0; c->fdin = fin ? fin : bstream_create(GDKin, 0); + if ( c->fdin == NULL){ + showException(GDKout, MAL, "initClientRecord", MAL_MALLOC_FAIL); + return NULL; + } c->yycur = 0; c->bak = NULL; @@ -218,8 +222,8 @@ MCinitClientRecord(Client c, oid user, b c->curprg = c->backup = 0; c->glb = 0; - /* remove garbage from previous connection - * be aware, a user can introduce several modules + /* remove garbage from previous connection + * be aware, a user can introduce several modules * that should be freed to avoid memory leaks */ c->usermodule = c->curmodule = 0; @@ -235,6 +239,10 @@ MCinitClientRecord(Client c, oid user, b prompt = !fin ? GDKgetenv("monet_prompt") : PROMPT1; c->prompt = GDKstrdup(prompt); + if ( c->prompt == NULL){ + showException(GDKout, MAL, "initClientRecord", MAL_MALLOC_FAIL); + return NULL; + } c->promptlength = strlen(prompt); c->actions = 0; @@ -268,7 +276,7 @@ MCinitClient(oid user, bstream *fin, str /* * The administrator should be initialized to enable interpretation of - * the command line arguments, before it starts serviceing statements + * the command line arguments, before it starts servicing statements */ int MCinitClientThread(Client c) 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 @@ -384,9 +384,11 @@ cloneFunction(Module scope, Symbol proc, return NULL; } freeMalBlk(new->def); - new->def = copyMalBlk(proc->def); - if( new->def == NULL) + if((new->def = copyMalBlk(proc->def)) == NULL) { + freeSymbol(new); + fprintf(stderr,"cloneFunction() failed"); return NULL; + } /* now change the definition of the original proc */ #ifdef DEBUG_CLONE fprintf(stderr, "CLONED VERSION\n"); diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c --- a/monetdb5/mal/mal_import.c +++ b/monetdb5/mal/mal_import.c @@ -95,6 +95,10 @@ malLoadScript(Client c, str name, bstrea throw(MAL, "malInclude", "file %s too large to process", name); } *fdin = bstream_create(fd, sz == 0 ? (size_t) (2 * 128 * BLOCK) : sz); + if(*fdin == NULL) { + mnstr_destroy(fd); + throw(MAL, "malInclude", MAL_MALLOC_FAIL); + } if (bstream_next(*fdin) < 0) mnstr_printf(c->fdout, "!WARNING: could not read %s\n", name); return MAL_SUCCEED; diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c --- a/monetdb5/mal/mal_session.c +++ b/monetdb5/mal/mal_session.c @@ -327,6 +327,12 @@ MSscheduleClient(str command, str challe /* move this back !! */ if (c->usermodule == 0) { c->curmodule = c->usermodule = userModule(); + if(c->curmodule == NULL) { + mnstr_printf(fout, "!could not allocate space\n"); + exit_streams(fin, fout); + GDKfree(command); + return; + } } if ((s = setScenario(c, lang)) != NULL) { diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c --- a/monetdb5/optimizer/opt_pipes.c +++ b/monetdb5/optimizer/opt_pipes.c @@ -458,7 +458,7 @@ compileOptimizer(Client cntxt, const cha if( compiled){ pipes[j].mb = compiled->def; //fprintFunction(stderr, pipes[j].mb, 0, LIST_MAL_ALL); - } + } } } } diff --git a/monetdb5/optimizer/opt_remap.c b/monetdb5/optimizer/opt_remap.c --- a/monetdb5/optimizer/opt_remap.c +++ b/monetdb5/optimizer/opt_remap.c @@ -129,7 +129,9 @@ OPTmultiplexInline(Client cntxt, MalBlkP /* * Determine the variables to be upgraded and adjust their type */ - mq= copyMalBlk(s->def); + if((mq = copyMalBlk(s->def)) == NULL) { + return 0; + } sig= getInstrPtr(mq,0); #ifdef DEBUG_OPT_REMAP fprintf(stderr,"#Modify the code\n"); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list