Changeset: 061f0ff2169f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=061f0ff2169f Modified Files: monetdb5/optimizer/opt_dataflow.c monetdb5/optimizer/opt_macro.c monetdb5/optimizer/opt_mergetable.c Branch: Jan2014 Log Message:
Minor potential leakage fixes diffs (105 lines): diff --git a/monetdb5/optimizer/opt_dataflow.c b/monetdb5/optimizer/opt_dataflow.c --- a/monetdb5/optimizer/opt_dataflow.c +++ b/monetdb5/optimizer/opt_dataflow.c @@ -77,8 +77,12 @@ void removeDataflow(MalBlkPtr mb) char *delete= (char*) GDKzalloc(mb->stop); char *used= (char*) GDKzalloc(mb->vtop); - if ( delete == 0 || init == 0 || used == 0) + if ( delete == 0 || init == 0 || used == 0){ + if( delete) GDKfree(delete); + if( used) GDKfree(used); + if( init) GDKfree(init); return; + } old = mb->stmt; limit = mb->stop; if ( newMalBlkStmt(mb, mb->ssize) <0 ) diff --git a/monetdb5/optimizer/opt_macro.c b/monetdb5/optimizer/opt_macro.c --- a/monetdb5/optimizer/opt_macro.c +++ b/monetdb5/optimizer/opt_macro.c @@ -23,11 +23,6 @@ #include "mal_interpreter.h" #include "mal_instruction.h" -/* - * @- - * The optimizer hooks are introduced first. - * They are refered to from the optimizer module. - */ static int malMatch(InstrPtr p1, InstrPtr p2) { @@ -57,7 +52,6 @@ malMatch(InstrPtr p1, InstrPtr p2) } /* - * @- * Matching a block calls for building two variable lists used. * The isomorphism can be determined after-wards using a single scan. * The candidate block is matched with mb starting at a given pc. @@ -117,7 +111,7 @@ malFcnMatch(MalBlkPtr mc, MalBlkPtr mb, return 1; } /* - * @- Macro expansions + * Macro expansions * The macro expansion routine walks through the MAL code block in search * for the function to be expanded. * The macro expansion process is restarted at the first new instruction. @@ -273,7 +267,6 @@ inlineMALblock(MalBlkPtr mb, int pc, Mal } /* - * @- * The macro processor should be carefull in replacing the * instruction. In particular, any RETURN or YIELD statement * should be replaced by a jump. For the time being, @@ -332,7 +325,6 @@ MACROprocessor(Client cntxt, MalBlkPtr m } /* - * @- Macro inversions * Macro inversions map a consecutive sequences of MAL instructions * into a single call. Subsequence resolution will bind it with the proper * function. The pattern being replaced should be a self-standing @@ -471,14 +463,16 @@ OPTmacroImplementation(Client cntxt, Mal j = getSubScope(fcn); for (t = s->subscope[j]; t != NULL; t = t->peer) if (t->def->errors == 0) { - if (getSignature(t)->token == FUNCTIONsymbol) - MACROprocessor(cntxt, target, t); + if (getSignature(t)->token == FUNCTIONsymbol){ + str msg = MACROprocessor(cntxt, target, t); + if( msg != MAL_SUCCEED) + GDKfree(msg); + } } } return 1; } /* - * @- * The optimizer call infrastructure is identical to the liners * function with the exception that here we inline all possible * functions, regardless their @@ -525,7 +519,7 @@ OPTorcamImplementation(Client cntxt, Mal return 1; } /* - * @- Optimizer code wrapper + * Optimizer code wrapper * The optimizer wrapper code is the interface to the MAL optimizer calls. * It prepares the environment for the optimizers to do their work and removes * the call itself to avoid endless recursions. diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -1451,6 +1451,7 @@ OPTmergetableImplementation(Client cntxt mb->stmt = (InstrPtr *) GDKzalloc(size * sizeof(InstrPtr)); if ( mb->stmt == NULL) { mb->stmt = old; + GDKfree(mat); return 0; } mb->ssize = size; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list