Changeset: d2313b6847a3 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2313b6847a3 Modified Files: MonetDB/src/gdk/gdk_bat.mx MonetDB5/src/mal/mal_box.mx MonetDB5/src/mal/mal_function.mx MonetDB5/src/mal/mal_instruction.mx MonetDB5/src/mal/mal_profiler.mx Branch: Jun2010 Log Message:
Hardening: check for allocation failures and stuff like that. diffs (91 lines): diff -r b2c8467b4043 -r d2313b6847a3 MonetDB/src/gdk/gdk_bat.mx --- a/MonetDB/src/gdk/gdk_bat.mx Mon Jul 05 12:28:45 2010 +0200 +++ b/MonetDB/src/gdk/gdk_bat.mx Mon Jul 05 12:30:48 2010 +0200 @@ -102,6 +102,8 @@ @c BATstore *bs = (BATstore *) GDKzalloc(sizeof(BATstore)); + if (bs == NULL) + return NULL; @- assert needed in the kernel to get symbol eprintf resolved. Else modules using assert fail to load. diff -r b2c8467b4043 -r d2313b6847a3 MonetDB5/src/mal/mal_box.mx --- a/MonetDB5/src/mal/mal_box.mx Mon Jul 05 12:28:45 2010 +0200 +++ b/MonetDB5/src/mal/mal_box.mx Mon Jul 05 12:30:48 2010 +0200 @@ -599,12 +599,13 @@ int i; b = BATnew(TYPE_int, TYPE_str, (BUN) MAXSPACES); + if (b == NULL) + throw(MAL, "box.getBoxNames", MAL_MALLOC_FAIL); for (i = 0; i < topbox; i++) if (malbox[i] != NULL) { BUNins(b, &i, malbox[i]->name, FALSE); } - BBPincref(*bid = b->batCacheid, TRUE); - BBPunfix(*bid); + BBPkeepref(*bid = b->batCacheid); return MAL_SUCCEED; } diff -r b2c8467b4043 -r d2313b6847a3 MonetDB5/src/mal/mal_function.mx --- a/MonetDB5/src/mal/mal_function.mx Mon Jul 05 12:28:45 2010 +0200 +++ b/MonetDB5/src/mal/mal_function.mx Mon Jul 05 12:30:48 2010 +0200 @@ -116,7 +116,11 @@ InstrPtr p; s = newSymbol(nme,kind); + if (s == NULL) + return NULL; p = newInstruction(NULL,kind); + if (p == NULL) + return NULL; setModuleId(p, mod); setFunctionId(p, nme); setDestVar(p, newVariable(s->def,GDKstrdup(nme),TYPE_any)); @@ -126,6 +130,8 @@ InstrPtr newCall(Module scope, str fcnname, int kind){ InstrPtr p; p= newInstruction(NULL,kind); + if (p == NULL) + return NULL; setModuleScope(p, scope); setFunctionId(p, putName(fcnname,strlen(fcnname))); return p; diff -r b2c8467b4043 -r d2313b6847a3 MonetDB5/src/mal/mal_instruction.mx --- a/MonetDB5/src/mal/mal_instruction.mx Mon Jul 05 12:28:45 2010 +0200 +++ b/MonetDB5/src/mal/mal_instruction.mx Mon Jul 05 12:30:48 2010 +0200 @@ -601,7 +601,7 @@ } cur = (Symbol) GDKzalloc(sizeof(SymRecord)); if (cur == NULL) { - GDKerror("@1:"MAL_MALLOC_FAIL); + GDKerror("newSymbol:"MAL_MALLOC_FAIL); return NULL; } cur->name = putName(nme,strlen(nme)); @@ -991,6 +991,8 @@ } if (p == NULL) { p = GDKzalloc(MAXARG * sizeof(p->maxarg) + sizeof(InstrRecord)); + if (p == NULL) + return NULL; p->maxarg = MAXARG; } p->typechk = TYPE_UNKNOWN; diff -r b2c8467b4043 -r d2313b6847a3 MonetDB5/src/mal/mal_profiler.mx --- a/MonetDB5/src/mal/mal_profiler.mx Mon Jul 05 12:28:45 2010 +0200 +++ b/MonetDB5/src/mal/mal_profiler.mx Mon Jul 05 12:30:48 2010 +0200 @@ -1029,10 +1029,10 @@ } b = BATnew(TYPE_void, tt, 1 << 16); - BATseqbase(b, 0); if (b == NULL) return NULL; + BATseqbase(b, 0); BATkey(b, TRUE); BBPrename(b->batCacheid, buf); BATmode(b, PERSISTENT); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list